Tuesday, 24 September 2013

How to send sms using c#,asp.net

How to sms using c# and asp.net:


Code Behind:


 if (txtfname.Text != "" && txtphone.Text != "" && txtadd.Text != "")
        {
 
        string name = txtfname.Text;
        string phne = txtphone.Text;
 
        string add = txtadd.Text;

        string bdy = name + "," + phne + "," + add;
        SmtpClient smtpserver = new SmtpClient();

        MailMessage mail = new MailMessage();
        smtpserver.Credentials = new System.Net.NetworkCredential("rajkumar550", "rajkumar123");
        smtpserver.Host = "xxx.com";
        mail.From = new MailAddress("rajkumar550@xxx.com");
        mail.To.Add("+91" + phone + "@sms.xxx.com");
        mail.Subject = "hi";
        mail.Body = bdy;
        smtpserver.Send(mail);



}

No comments:

Post a Comment