在c#中使用Internet发送短信 [英] Send sms using Internet in c#
本文介绍了在c#中使用Internet发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在c#中使用Internet发送短信。我试过差异。 diff发布的技术。作者'但是没有成功。如果你有任何溶胶。请帮助我。
谢谢
I want to Send sms using Internet in c#.I tried diff. technique posted by diff. author''s but was unsuccessfull. If u hav any sol. plz help Me.
Thank you
推荐答案
一种方法是用你的Gmail账号发送短信
One approach would be to send a text message with your gmail account
using System.Net;
using System.Net.Mail;
public void SendTextMessage(string subject, string message, long telephoneNumer)
{
// login details for gmail acct.
const string sender = "me@gmail.com";
const string password = "mypassword4gmailacct";
// find the carriers sms gateway for the recipent. txt.att.net is for AT&T customers.
string carrierGateway = "txt.att.net";
// this is the recipents number @ carrierGateway that gmail use to deliver message.
string recipent = string.Concat(new object[]{
telephoneNumer,
'@',
carrierGateway
});
// form the text message and send
using (MailMessage textMessage = new MailMessage(sender, recipent, subject, message))
{
using (SmtpClient textMessageClient = new SmtpClient("smtp.gmail.com", 587))
{
textMessageClient.UseDefaultCredentials = false;
textMessageClient.EnableSsl = true;
textMessageClient.Credentials = new NetworkCredential(sender, password);
textMessageClient.Send(textMessage);
}
}
}
对于Sms网关列表,请检查http://en.wikipedia.org/wiki/List_of_SMS_gateways [ ^ ]
注意:当食谱响应消息时,消息将被发送到您的Gmail帐户...非常适合备份: - )
For a List of Sms Gateways check http://en.wikipedia.org/wiki/List_of_SMS_gateways[^]
Note: When the recipent responds to the message the message will be sent to your gmail account...Great for backups :-)
看看这个 link [ ^ ]
特别寻找AlexFeinman的回复,尤其是来自saslic的回复
Have a look at this link[^]
In particular look for the responses from AlexFeinman but especially from saslic
使用您的way2sms帐户发送短信
使用smsClient.dll使用你的way2sms账号发送短信
你可以从下面的步骤下载smsClient.dll链接
http:/ /skdotnetdeveloper.blogspot.in/2011/09/send-sms-in-cnet.html
添加此dll的引用并使用以下代码发送短信
Sending SMS using your way2sms account
Use smsClient.dll for sending sms using your way2sms account
You can download smsClient.dll from the following link
http://skdotnetdeveloper.blogspot.in/2011/09/send-sms-in-cnet.html
Add reference of this dll and use this following code for sending the sms
SmsClient.SendSms sms = new SmsClient.SendSms();
//string status=sms.send(way2smsuserid, way2smspassword, message, tonumber);
这篇关于在c#中使用Internet发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文