C#代码,用于通过网关或邮件从PC向手机发送短信 [英] C# code for sending sms from pc to mobile via gateway or mail
本文介绍了C#代码,用于通过网关或邮件从PC向手机发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道吗请回答:
Can Anyone know please answer:
C# code for sending sms from pc to mobile via gateway or mail
推荐答案
请参见
相同的答案
SMSAdapter adapter1 = new SMSAdapter();
adapter1.Username = "username";
adapter1.Password = "password";
SMSMessage message = new SMSMessage();
message.recipient = "mobileno";
message.message = txtmessage.Text;
adapter1.Send(message);
您好
检查一下SMS API
通过使用该API,我们可以发送最近使用的SMS
API文档中详细介绍了该API中的代码
在这里,我提供了该代码的示例代码
网站链接为 http://www.txtimpact.com/api.asp [^ ]
Hi
Check this out for SMS API
By using that API we can send SMS which is recently I used
the Code in that API is detailed in API documentation
Here I''m providing sample code for that
The link to website is http://www.txtimpact.com/api.asp[^]
string ret=string.Empty;
WebRequest w=WebRequest.Create("http://smsapi.Wire2Air.com/smsadmin/submitsm.aspx");
w.Method="POST";
w.ContentType="application/x-www-form-urlencoded";
using(Stream writeStream = w.GetRequestStream())
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes("VERSION=2.0&userid=[username]&password=[userpassword]&VASId=[VASId] & PROFILEID =[ PROFILEID ]& FROM =27126&TO=[Mobile Number]&Text=[Text Message]);
writeStream.Write(bytes, 0, bytes.Length);
}
using (HttpWebResponse r = (HttpWebResponse) w.GetResponse())
{
using (Stream responseStream = r.GetResponseStream())
{
using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8))
{
ret = readStream.ReadToEnd();
}
}
}
MessageBox.Show(ret); /* result of API call*/
最好的
All the Best
这篇关于C#代码,用于通过网关或邮件从PC向手机发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文