Click here to Skip to main content
15,891,835 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
send me the code for sending sms to mobile
Posted

Before going through the code, here are some details, you need to understand.

Just like sending email, you need a SMTP, for SMS you need a SMPP. SMPP - Short Message Peer-to-Peer protocol is a telecommunications industry protocol for exchanging SMS messages. Now for individuals, it is not possible to afford SMPP server, so here goes the SMS Service Provider. Though most of the SMS Service providers are fake and work just as a reseleer under a Real Service Provider(have integrated SMPP).

The code is very straight forward. Most of the cases, you need to do HTTP Post.

So, no particular code will help you. First select the Service Provider and buy some credits and they will provide you the sample code.


Here is a sample code works with most of the Service Provider,

string senderusername = "xxxxx";
string senderpassword = "xxxx";
string senderid = "xxx";        
string sURL;
StreamReader objReader;
sURL = "service provider url with username,password,senderid,messagetext,tomobile and others passed as querysrring";
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
try
{
     Stream objStream;
     objStream = wrGETURL.GetResponse().GetResponseStream();
     objReader = new StreamReader(objStream);
     //here you get the response - sent success or fail
     objReader.Close();
}
catch (Exception ex)
{
   ex.ToString();
}


Hope this clears you.

cheers
 
Share this answer
 
v2
Please check below url, this will help you to send sms using way2sms account

Sending SMS From .NET Desktop Application[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900