C#实现给手机发送短信
public static void SendSMS(string FaSongUser, string ToUserList, string
ContentStr)
{
//针对不同的短信猫接口,请修改此方法
string MobTelList =
"";
//根据用户名列表获取手机号码
admin,test,zwl,test123
DataSet
MyDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select JiaTingDianHua from ERPUser
where UserName in(‘" + ToUserList.Replace(",", "‘,‘") +
"‘)");
for (int i = 0; i <
MyDT.Tables[0].Rows.Count; i++)
{
if
(MobTelList ==
"")
{
MobTelList =
MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString();
}
else
{
if (MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString().Trim().Length >
0)
{
MobTelList = MobTelList + "," +
MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString();
}
}
}
//发送短信
MobCallClient.SMS MySms =
new MobCallClient.SMS();
string
StateStr=MySms.SendSMS(ConfigurationManager.AppSettings["enCode"],
ConfigurationManager.AppSettings["enPassword"],
ConfigurationManager.AppSettings["userName"], MobTelList,
ContentStr);
}
//发送外部短信,直接是手机号码列表
public static
void SendSMS2(string FaSongUser, string ToUserList, string
ContentStr)
{
string MobTelList =
ToUserList;
//发送短信
MobCallClient.SMS MySms =
new MobCallClient.SMS();
string
StateStr = MySms.SendSMS(ConfigurationManager.AppSettings["enCode"],
ConfigurationManager.AppSettings["enPassword"],
ConfigurationManager.AppSettings["userName"], MobTelList,
ContentStr);
}
public static void
GetSMS(string GetUserName)
{
//针对不同的短信猫接口,请修改此方法
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。