且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从asp.net网站发送短信

更新时间:2023-02-16 23:32:37

快速了解整个SMS应用程序及其工作原理< a href ="http://www.codeproject.com/KB/IP/Sending_SMS_using_Net.aspx">单击此处.</a> [< a href ="http://www.codeproject.com/KB/IP /Sending_SMS_using_Net.aspx"target =" _ blank"title ="新窗口> ^</a>]



1.首先,您需要一个可以发送短信的短信服务器.
2.使用System.Net.Mail
3.创建MailMessage类的对象
MailMessage email =新的MailMessage("xyz@org.com",已收据);

将所需信息添加到对象
email.subject =手机号码"//这应该是手机号码.
email.TO ="xyz@org.com";
email.From ="pqr@org.com"

4. creata SMTPClient对象
5.使用上面的SMTPClient对象发送消息.
SMTPClient objClient =新的SMTPClient();
objClient.send(email);
6.这样您的服务器会将SMS发送到主题中添加的号码.


希望这会有所帮助. :)


hiiiiiiiii i am developing web site which send free sms to client.. and for that i need to send sms from asp.net web application. i am using asp.net framework 3.5. i am already check many web help but that are now working plz.. help me

To get quick overview for entire SMS application and how it works <a href="http://www.codeproject.com/KB/IP/Sending_SMS_using_Net.aspx">Click here.</a>[<a href="http://www.codeproject.com/KB/IP/Sending_SMS_using_Net.aspx" target="_blank" title="New Window">^</a>]


Hi
1. First you need a sms server which will send the SMS.
2. using System.Net.Mail
3. create object of MailMessage class
MailMessage email= new MailMessage("xyz@org.com", receipes);

add the required information to the object
email.subject= "mobile number"// this should be the mobile number.
email.TO ="xyz@org.com";
email.From="pqr@org.com"

4. creata SMTPClient object
5. using the above SMTPClient object send the message.
SMTPClient objClient= new SMTPClient();
objClient.send(email);
6. so your server will send the SMS to the Numbers which are added in the Subject.


Hope this will help. :)