将自定义发件人 ID 用于出站短信 Nexmo
Using Custom SenderID for outbound SMS Nexmo
如果我想使用自定义 SenderID,是否需要添加更多 applicationsetting.json 或代码?
假设我已经购买了 SenderID
这是我的代码:
string PhoneNo = "081375840392";
string SenderID = "CUSTOM";
var results = SMS.Send(new SMS.SMSRequest
{
from = SenderID,
to = PhoneNo,
text = "Test Sms"
});
这是我的 appsettings.json
{
"appSettings": {
"Nexmo.UserAgent": "myApp/1.0",
"Nexmo.Url.Rest": "https://rest.nexmo.com",
"Nexmo.Url.Api": "https://api.nexmo.com",
"Nexmo.api_key": "369b4188",
"Nexmo.api_secret": "0d1479g48e641c89",
"Nexmo.Application.Id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"Nexmo.Application.Key": "c:\path\to\your\application\private.key"
}
}
不需要再添加了appsettings.json
只需更改 from 参数
如果我想使用自定义 SenderID,是否需要添加更多 applicationsetting.json 或代码?
假设我已经购买了 SenderID
这是我的代码:
string PhoneNo = "081375840392";
string SenderID = "CUSTOM";
var results = SMS.Send(new SMS.SMSRequest
{
from = SenderID,
to = PhoneNo,
text = "Test Sms"
});
这是我的 appsettings.json
{
"appSettings": {
"Nexmo.UserAgent": "myApp/1.0",
"Nexmo.Url.Rest": "https://rest.nexmo.com",
"Nexmo.Url.Api": "https://api.nexmo.com",
"Nexmo.api_key": "369b4188",
"Nexmo.api_secret": "0d1479g48e641c89",
"Nexmo.Application.Id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"Nexmo.Application.Key": "c:\path\to\your\application\private.key"
}
}
不需要再添加了appsettings.json 只需更改 from 参数