protected void btnSend_Click(object sender, System.EventArgs e) { string @string = WebUtils.GetString(this.TextBox5.Text); ISMS iSMS = SMSProvider.Create(PageBase.config.SMSClass); if (iSMS == null) { base.ShowMsg("短信接口配置不正确"); } else if (!ValidateUtils.IsMobilePhone(@string)) { base.ShowMsg("无效的手机号码"); } else { string value = iSMS.SendMsg(@string, "这是一条测试短信,如果您收到此短信,表示短信服务有效![" + PageBase.config.SiteName + "]"); if (iSMS.IsSuccess) { base.ShowMsg("测试短信发送成功"); } else { base.ShowMsg(WebUtils.GetString(value)); } } }
public static int SendSMS(string strToMobile, string strType, string strContent, string strValidateCode, ref string retResult) { int result = 0; ISMS iSMS = SMSProvider.Create(); if (iSMS != null) { iSMS.Mobile = strToMobile; iSMS.SMSContent = strContent; retResult = iSMS.SendMsg(); if (iSMS.IsSuccess) { SMSInfo entity = new SMSInfo { SMSMob = iSMS.Mobile, SMSText = iSMS.SMSContent, SMSType = strType, ValidateCode = strValidateCode, ReturnMsg = retResult, Status = 1, AutoTimeStamp = DateTime.Now }; result = BLL.SMS.Add(entity); } } return(result); }