C # Mass SMS

Source: Internet
Author: User

In the program that sends the text message, we add using System.Net in the code editing area, namespace.

   private string url =  "http://utf8.sms.webchinese.cn/";         //private string URL =  "HTTP +/ Utf8.sms.webchinese.cn/? uid=xiaokai&key=&smsmob= mobile phone number &smstext= SMS content ";         private  string strUid =  "Uid=";        //private  string strkey =  "&key=8df38a399aa3bb8f632f";         private string strKey =  "&key=";         private string strmob =  "&smsmob=";         private string strcontent =  "&smstext=";  /// <summary>         ///  Mass Message         ///  </summary>         /// <param name= "url" >         ///  given an explicit address (including phone, username, secret key)         /// < /param>        /// <returns>     The     ///  return value is used to determine whether the send succeeded         /// </ Returns>        public string gethtmlfromurl (string  URL)         {             string strRet = null;             if  (url == null | |  url. Trim (). ToString ()  ==  "")             {                 return strret;             }            string targeturl =  url. Trim (). ToString ();            try             {                 HttpWebRequest hr =  (HttpWebRequest) WebRequest.Create ( TargetUrl);                 hr. useragent =  "mozilla/4.0  (compatible; msie 6.0; windows nt 5.1)";                 hr. method =  "GET";                 hr. Timeout = 30 * 60 * 1000;                 webresponse hs = hr. GetResponse ();                 Stream sr = hs. GetResponseStream ();                 streamreader ser = new streamreader (Sr, encoding.default);                 strret = ser. ReadToEnd ();            }             catch  (Exception ex)              {                 strret = null;                 messagebox.show (ex. Message);            }             return strRet;         }                       /// <summary>        ///   Send SMS         /// </summary>         /// <param name= "Sender" ></param>         /// <param name= "E" ></param>         private void btn_send_click (object sender, eventargs e)          {            if  (Txt_ Username. Text.tostring (). Trim ()  !=  ""  && textbox4.text.tostring (). Trim ()  !=  " && textbox2.text.tostring ()  != null)              {                 url = url + struid + txt_username. Text + strkey + txt_key. text + strmob + textbox4.text + strcontent + textbox2.text;                 string result  = gethtmlfromurl (URL);                 messagebox.show (Result);            &nBSP;}             else             {                 messagebox.show ("Please fill in complete, do not empty!") ");            }         }

The above process of sending SMS is used by the API provided by China Network. Refer to the following:

China network construction, SMS mass platform


C # Mass SMS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.