吴岳明,宝路捷车管家,长篇成人小说
3.调用 amazonsimplenotificationserviceclient 发送sms
string defaultsenderid="appname";
string message = "[appname] enter this verification code 000000 in your app now.";//消息
string phonenumber = "+8618372712159"; //手机号
string defaultsmstype = "promotional"; //promotional – 不重要的消息|transactional – 为客户事务处理提供支持的重要消息
sms_entity mode = new sms_entity() { contents = message, mobilenumber = phonenumber };
try
{
amazonsimplenotificationserviceclient snsclient = new amazonsimplenotificationserviceclient(awsaccesskeyid, awssecretaccesskey, regionendpoint.apsoutheast1);
publishrequest publishreq = new publishrequest();
publishreq.message = message;
publishreq.phonenumber = phonenumber;
publishreq.messageattributes = new dictionary<string, messageattributevalue>();
publishreq.messageattributes.add("aws.sns.sms.senderid", new messageattributevalue() { datatype = "string", stringvalue = defaultsenderid });
publishreq.messageattributes.add("aws.sns.sms.smstype", new messageattributevalue() { datatype = "string", stringvalue = defaultsmstype });
publishresponse response = snsclient.publish(publishreq);
mode.response = jsonconvert.serializeobject(response);
mode.sendstatus = response.httpstatuscode.tostring();
if (response.httpstatuscode == system.net.httpstatuscode.ok)
mode.result = true;
else
mode.result = false;
}
catch (exception ex)
{
mode.sendstatus = "error:" + ex.message;
mode.result = false;
}
注意:awsaccesskeyid,awssecretaccesskey,regionendpoint,需要登陆aws的控制台查看
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论