Esempio n. 1
0
 /// <summary>
 /// 发短信(公共发送短信)
 /// </summary>
 /// <param name="mobile"></param>
 /// <param name="content"></param>
 /// <returns></returns>
 public static string SendSMS(string mobile, string content)
 {
     try
     {
         var config   = SMSConfigInfo.GetConfigByXmlConfig(SettingConfigAnalyzer.GetConfigElementByKey("SMSAgent"));
         var instance = GetSMSSenderInstance(config);
         return(instance.SendSMS(mobile, content, config.Attach));
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Esempio n. 2
0
        public static ISMSSend GetSMSSenderInstance(SMSConfigInfo config)
        {
            switch (config.AgentName.ToUpper())
            {
            case "HTSMS":
                return(new HTSMS(config.UserName, config.Password, config.Attach));

            case "IOSMS":
                return(new IOSMS(config.UserName, config.Password, config.Attach));

            case "BYSMS":
                return(new BYSMS(config.UserName, config.Password, config.Attach));

            case "GYSMS":
                return(new GYSMS(config.UserName, config.Password, config.Attach));

            case "C123":
                return(new C123(config.UserName, config.Password, config.Attach));

            case "WXT":
                return(new WXTSMS(config.UserName, config.Password, config.Attach));

            case "ANDROIDSMS":
                return(new AndroidSMS(config.UserName, config.Password, config.Attach));

            case "VEESING":
                return(new VeeSingSMS(config.UserName, config.Password, config.Attach));

            case "YMSMS":
                return(new YMSMS(config.UserName, config.Password, config.Attach));

            case "CFSMS":
                return(new CFSMS(config.UserName, config.Password, config.Attach));

            default:
                throw new ArgumentException("不支持的短信代理 - " + config.AgentName);
            }
        }