苹果签名

iphoneqm
首页 > 苹果签名 > 正文内容

c#简单易用的短信发送服务 悠逸企业短信服务

admin12个月前 (12-19)苹果签名366

  悠逸企业短信发送服务,是一种比较简单易操作的短信发送服务,使用POST的方式,请求相应地址就可以实现短信发送功能

c#简单易用的短信发送服务 悠逸企业短信服务

  1 ///

  2 /// 短信发送服务

  3 ///

  4 public class ShortMsgHelper

  5 {

  6 ///

  7 /// 短信服务 账号

  8 ///

  9 private static string uid = ConfigurationManager.AppSettings["ShortMSGUid"];

  10 ///

  11 /// 短信服务 密码

  12 ///

  13 private static string pwd = ConfigurationManager.AppSettings["ShortMSGPwd"];

  14 ///

  15 /// 客服 手机号字符串

  16 ///

  17 private static string CustomerServicePhoneList = ConfigurationManager.AppSettings["CustomerServicePhoneList"];

  18 ///

  19 /// 短信服务 签名(短信内容后面加上 此签名 才能发送成功!形式为:【签名内容】)如果不加,则发送无效

  20 ///

  21 private static string ShortMSGSignature = ConfigurationManager.AppSettings["ShortMSGSignature"];

  22 ///

  23 /// 短信服务 开关

  24 /// open:打开 close:关闭

  25 ///

  26 private static string ShortMSGSwitch = ConfigurationManager.AppSettings["ShortMSGSwitch"];

  27

  28 ///

  29 /// 发送短信开放方法

  30 ///

  31 ///

  32 ///

  33 public static bool Send(string msgContent,List pList)

  34 {

  35 //依据短信服务开关

  36 if (ShortMSGSwitch=="close")

  37 {

  38 return false;

  39 }

  40 List phoneList = new List();

  41 if (pList==null||pList.Count==0)

  42 {

  43 phoneList = CustomerServicePhoneList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();

  44 }

  45 else

  46 {

  47 phoneList = pList;

  48 }

  49

  50 return SendMobileMsg(uid, pwd, msgContent, phoneList);

  51 }

  52 ///

  53 /// 短信发送

  54 ///

  55 /// 悠逸企业短信ID

  56 /// 悠逸企业短信密码

  57 /// 短信内容

  58 /// 手机号列表

  59 ///

  60 private static bool SendMobileMsg(string uid, string pwd, string msgContent, List destListPhones)

  61 {

  62 try

  63 {

  64 bool result = false;

  65 string strPhones = string.Join(";", destListPhones.ToArray());

  66 strPhones += ";";

  67 var encoding = System.Text.Encoding.GetEncoding("GB2312");

  68

  69 string postData = string.Format("uid={0}&pwd={1}&mobile={2};&msg={3}&dtime=", uid, pwd, strPhones, msgContent + ShortMSGSignature);

  70

  71 byte[] data = encoding.GetBytes(postData);

  72

  73 // 定义 WebRequest

  74 HttpWebRequest myRequest =

  75 (HttpWebRequest)WebRequest.Create("://.smsadmin/smsmarketing/root/api/post_send/");

  76

  77 myRequest.Method = "POST";

  78 myRequest.ContentType = "application/x--form-urlencoded";

  79 myRequest.ContentLength = data.Length;

  80

  81 Stream newStream = myRequest.GetRequestStream();

  82

  83 //发送数据

  84 newStream.Write(data, 0, data.Length);

  85 newStream.Close();

  86

  87 // 得到 Response

  88 HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();

  89 StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);

  90 string content = reader.ReadToEnd();

  91

  92 if (content.Substring(0, 1) == "0")

  93 result = true;

  94 else

  95 {

  96 if (content.Substring(0, 1) == "2") //余额不足

  97 {

  98 //"手机短信余额不足";

  99 //TODO

  100 }

  101 else

  102 {

  103 //短信发送失败的其他原因,请参看官方API

  104 }

  105 result = false;

  106 }

  107

  108 return result;

  109 }

  110 catch

  111 {

  112 return false;

  113 }

  114

  115 }

  116 }

扫描二维码推送至手机访问。

版权声明:本文由MDM苹果签名,IPA签名,苹果企业签名,苹果超级签,ios企业签名,iphoneqm.com发布,如需转载请注明出处。

转载请注明出处https://www.iphoneqm.com/iphoneqm/582.html

分享给朋友:

相关文章

App难上架苹果商店?微导流TF签名官方认可上架方式

App难上架苹果商店?微导流TF签名官方认可上架方式

  3、微导流tf签名链接安装有效期为多长时间?   有效期为3个月,微导流tf签名上架成功后3个月内均可使用。   4、链接下载次数限制为多少?   每个安装链接最多下载10000...

一文读懂Https的安全性原理、数字证书、单项认证、双项认证等

一文读懂Https的安全性原理、数字证书、单项认证、双项认证等

  本文引用了作者Smily(博客:blog.csdn.net/_20521573)的文章内容,感谢无私分享。   目前苹果公司已经强制iOS应用必须使用HTTPS协议开发(详见《苹果即将强制实...

ios 企业签名需要源文件么_苹果超级签名和ios企业签名的区别

ios 企业签名需要源文件么_苹果超级签名和ios企业签名的区别

  现在我们所了解到的,如果一个已开发的应用程序想要在ios系统上安装和使用,除了应用商店之外,它还可以使用签名方法。所谓的签名是指应用程序的身份验证,有了这个认证,应用程序可以在ios系统上正常安装...

苹果起诉初创公司:窃取芯片设计机密 利用员工拷贝保密数据

苹果起诉初创公司:窃取芯片设计机密 利用员工拷贝保密数据

  原标题:苹果起诉初创公司窃取芯片设计机密 声称其利用员工从公司拷贝大量保密数据   近日,苹果公司在加利福尼亚州起诉了一家名为 Rivos 的初创公司,指控其涉嫌窃取芯片技术商业机密。...

苹果停止对iOS 17.5.1系统的签名支持 用户无法降级

苹果停止对iOS 17.5.1系统的签名支持 用户无法降级

  2024-08-07 01:40:49作者:姚立伟   根据最新公告,苹果公司现已停止对iOS 17.5.1系统的签名支持,这意味着已经升级到更高版本的用户将无法自行降级。此举旨在鼓励用户保...

app签名到期怎么办

app签名到期怎么办

  如果发现手机的APP签名到期了,那么可以卸载重新安装最新版本。   所有的Android应用程序都要求开发人员用一个证书进行数字签名,Android系统不会安装没有进行签名的程序,签名有一个...

现在,非常期待与您的又一次邂逅

我们努力让每一次邂逅总能超越期待

  • 高效满意
    高效满意

    专业的技术团队

  • 性能稳定
    性能稳定

    响应速度快,放心有保障

  • 用户体验
    用户体验

    响应式布局,兼容各种设备

  • 持续更新
    持续更新

    不断升级维护,更好服务用户