//发送内容,移动号码等到MAS机:
public void sendMAS(string content, string mobilePhones)
{
try
{
url = PageBase.URL;
string response = "";
Encoding enc = System.Text.Encoding.GetEncoding("gb2312");
MsgContent = HttpUtility.UrlEncode(content, enc);
string inputurl = url + "?MobilePhones=" + mobilePhones + "&Content=" + MsgContent + "&MessageFlag=123" + "&ModuleName=" + PageBase.ModuleName + "&ExNumber=" + PageBase.ExNumber + "&Priority=1";
HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(inputurl);
HttpWebResponse rp = (HttpWebResponse)rq.GetResponse();
Stream s = rp.GetResponseStream();
StreamReader sr = new StreamReader(s);
string text = sr.ReadLine();
while (text != null)
{
response = response + text;
text = sr.ReadLine();
}
sr.Close();
}
catch (Exception error)
{
StreamWriter sw = new StreamWriter(@"c:\mail\mas.txt", true);
sw.WriteLine(error.Message);
sw.Close();
}
}
转载于:https://www.cnblogs.com/lvxiaolong/archive/2013/05/10/3070660.html