Pages

Search This Blog

Saturday 5 July 2014

Code for sending SMS....

Hi friends, in this session I will show the code for sending messages using ASP.NET.

Messaging was so useful to us in many situations like sending confirmation code, sending passwords and etc...

Here I took two textboxes and two labels and one button for submit. 1 textbox is used to take phone number as input (ID=”tbphone”) and another textbox is for message (ID=”msg”) .

Here is the code....

using System.Net.Mail;

//Message code
  string sURL;
  StreamReader objReader;

 //Specify the API you used to send SMS in sURL

       sURL = "http://smsdaddy.in/webapi.php?username=xyz &password=abc&sender=id &to=" + tbphone.Text + "&message=Thank You for using our website " + msg.Text+ "   ";

        WebRequest wrGETURL = WebRequest.Create(sURL);
        Stream objStream;
        objStream = wrGETURL.GetResponse().GetResponseStream();
        objReader = new StreamReader(objStream);
        objReader.Close();
      
//Message code ends here 

 You can rate my class on right side top of my blog.......

                                                                       -Your's santoshklpkl

No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips Twitter Bird Gadget