Send SMS in ASP.net and SharePoint using USB Dongle or Modem

Hi , Here i would like to explain how to send SMS using Dongle in ASP.net and SharePoint,

Below code set works for both ASP.net and SharePoint.

 

SerialPort serialport = new SerialPort(); // Create Serial port object to set physical Port in machine which dongle installed.

//Set Serial Port Properties
int mSpeed = 1;
 serialport.PortName ="COM16"; //Set Usb modem attached Port - as a example i'm using COM16 port
 serialport.BaudRate = 96000;
 serialport.Parity = Parity.None;
 serialport.DataBits = 8;
 serialport.StopBits = StopBits.One;
 serialport.Handshake = Handshake.XOnXOff;
 serialport.DtrEnable = true;
 serialport.RtsEnable = true;
 serialport.NewLine = Environment.NewLine;
//Sending SMS

serialport.WriteLine("AT+CMGF=1" + Environment.NewLine);
 System.Threading.Thread.Sleep(200);
 serialport.WriteLine("AT+CSCS=GSM" + Environment.NewLine);
 System.Threading.Thread.Sleep(200);
 serialport.WriteLine("AT+CMGS=" + (char)34 + "+94711022122"(char)34+Environment.NewLine);    //Set Recievers Phone Number
 System.Threading.Thread.Sleep(200);
 serialport.WriteLine(TextMessage + (char)26);
 System.Threading.Thread.Sleep(mSpeed);
 serialport.Close();

 

Thanks, Hope you learned something…….

 

 

Advertisements

Author: eshan1604

Hi Guys, I'm Udara Eshan Ariyarathne from Sri Lanka. Currently i'm working as a Software Engineer (Microsoft Technologies). I'm sharing some IT related articles such as Development ,Configuration and Designing things what i have learn from day to day works. Hope it useful all of us. "Enjoying IT" Thanks & Regards, Udara Eshan Ariyarthne

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s