Skip to main content

Sending SMS using AT Commands via GSM Modem/GSM Phone (receiving SMS-updated)


THE FULL SEND AND RECEIVED SMS SERVER with  complete Source Codes for developers are available to purchase.

.NET version is also available

Feel free to contact me at the addresses and links below:


This a sample how to send SMS using AT Commands like in Hyper Terminal via GSM Modem or compatible GSm phone attatched to the PC Comport or USB port..

For this sample i used Huawei E160 GSM/HSDPA/GPRS modem..

demonstrate how to use MSComm Control in VB6 in order to send data to the GSM Modem


this code may not work with other modem so better check your modem's specs and manual

check your modem's settings (baud Rate,RtsHold,HandShake, etc .and comport number in order to run this project..

Good NEWS:

java and php version will out this month..

THE FULL SEND AND RECEIVED SMS SERVER with  complete Source Codes for developers are available to purchase.

Feel free to contact me at the addresses and links below:

feel free to use and improved my sample code, 


Questions and request?


+639399393702 +639155338048

Blog Site

Facebook Fan Page


My status

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byAnonymous (not verified)on Mon, 06/29/2009 - 12:47

Hello Sir I want to ask all of you some question First I want to know about Sending SMS using AT Commands via GSM Modem/GSM Phone We can send to mobile phone right? If I has database(Phone Number) already Can I send it in the same time to all phone number that I have already in Database, If it's cannot, can you help me to update this programs, Chum Sorphorn Student, [email protected],[email protected]
Submitted byemondon Tue, 06/30/2009 - 10:14

In reply to by Anonymous (not verified)

Nope, only phones that supports AT commands, but most of all GSM modem supports At commands
Submitted byAnonymous (not verified)on Mon, 07/06/2009 - 18:08

i want to send more sms send at a time. how to give mobile numbers plesae give idea

All sms gateway provider requires you to pay before you can use their service. Actually you can do this using kannel gateway. But kannel runs on Linux only. You can use your mobile phone with kannel. But my experience on this sms gateway is that it is very hard to configure this software especially if you don't have enough knowledge on Linux operating system.
Submitted byAnonymous (not verified)on Mon, 07/20/2009 - 06:01

i am facing some difficulties. i am trying to create a website form ( visual basic 2005) and by using at commands and a gsm modem, enabling me to send SMS via the website. So am i able to use the same codes?
Submitted bypinunoon Mon, 12/26/2011 - 09:03

In reply to by Anonymous (not verified)

if the web site is intended to be uploaded in a commercial web hosting company, it is not advisable to use the said method of providing sms service not Unless you wIll be setting up your own web server...
Submitted byAnonymous (not verified)on Tue, 07/21/2009 - 19:15

how do i pay, and price
Submitted byAnonymous (not verified)on Wed, 07/29/2009 - 19:47

I can configure kannel for SMSC conectivity but I want to configure it for GSM modem which modem I can use with kannel Plz guide me and smskannel.conf file needs which modifications....?

hi,i really hope that you can help me on this.... i'm using serial to usb converter connection between my PC and my GSM modem. PC is USB, GSM is serial. I had no problem on sending SMS function , but i had a problem occurs on receive com event. which mean that the program show a error when finish sending sms. can you help me on this? i really need the solution on this part if not my project will going to turn off..

Hi guys!Am doing a project in the field of health, developing an application using kennel gateway that sends sms to mobiles of any platform not only for smart-phone.Please help me the any sample application source code that can help me as reference to start, please send to [email protected]
Submitted byAnonymous (not verified)on Fri, 08/07/2009 - 15:23

hello i am trying to write some code that helps me in sending a free sms to the mobile phones all over india like how the way2sms work i am trying to do it with the help of php and mysql. so any help with this regards will be so much helpful for me with regards Swathi.
Submitted byAnonymous (not verified)on Thu, 09/03/2009 - 10:51

salamat po... astig ng program nyo ^__^
Submitted byemondon Sun, 09/06/2009 - 10:08

In reply to by Anonymous (not verified)

welcome...Gudluck in your project.. All the best!!!

Plz help me with ths code modems are recognized by this guid: {4D36E96D-E325-11CE-BFC1-08002BE10318} here is the function: Public Function ShowComPorts() As String Dim comPorts As Array Dim out As String = "" comPorts = IO.Ports.SerialPort.GetPortNames() if comports Nothing then Dim m_RegEntry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine m_RegEntry = m_RegEntry.OpenSubKey("SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}") Dim i As Integer = 0 Dim m_szModemEntries As String() = m_RegEntry.GetSubKeyNames() Dim m_szModem = New String(m_szModemEntries.Length - 1) {} Dim m_szModemPort As String = Nothing Dim m_szModemName As String= Nothing For Each m_szModemEntry As String In m_szModemEntries m_RegEntry.Close() m_RegEntry = Microsoft.Win32.Registry.LocalMachine Dim m_szKeyName As String ="SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\" & m_szModemEntry m_RegEntry = m_RegEntry.OpenSubKey(m_szKeyName) m_szModemPort = m_RegEntry.GetValue("AttachedTo").ToString() m_szModemName = m_RegEntry.GetValue("Model").ToString() If Array.IndexOf(comPorts, m_szModemPort) > 0 Then out = out & m_szModemPort & " -" & (m_szModemName) & "***" else out = out End If Next Return out else return "" End Function it return a string that can be parsed to string-array in this mode: Dim ports() As String ports = Split(ShowComPorts(),"***") if you would to add to combobox: For i As Integer = 0 To ports.Length - 2 ComboBox1.Items.Add(ports(i)) Next for extract com port value from combobox: Dim numberCom as string=ComboBox1.SelectedItem.ToString.Substring(0 , ComboBox1.SelectedItem.ToString.IndexOf("-")).Trim) ps. function showcomport returnonly modem connected Now, if you would to have all modems that was connected to pc , just delete this if: If Array.IndexOf(comPorts, m_szModemPort) > 0 Then out = out & m_szModemPort & " -" & (m_szModemName) & "***" else out = out End If
Submitted byAnonymous (not verified)on Fri, 09/25/2009 - 15:03

In reply to by emond

Emond, i had a problem during sending sms, i'm successfully to send sms by using your program but the problem is the msg box appear as message is not sent, But actually i receive the msg. i using serial to usb converter, Is that the 1 make the problem?
Submitted byBoss (not verified)on Mon, 02/06/2012 - 11:18

In reply to by Anonymous (not verified)

I am the student of IT final year i need to submit project if u have some live project plz mail me thore am [email protected]
Submitted byericyeohon Thu, 09/10/2009 - 11:41

Emond, i'm doing a final year project which is related to GSM/GPRS modem to send sms as well as mms. But mms i will leave it 1st. I'm using PIC 16f and GSM wavecom Q2403. i'm wondering is the program u provide in this forum can be work with my modem? If i using PIC 16f how should i write to the VB to control the when to send a SMS to the owner by using GSM modem. Can you help me on this? I'm using 2 serial port connection, 1 is for GSM and the other 1 is for my PIC.
Submitted byAnonymous (not verified)on Thu, 09/10/2009 - 12:29

In reply to by ericyeoh

it is compatible with any GSM modem, just be sure that you will change the sample codes,like Baud rate, comport number, port settings, order to be compatible with your modem. regrds all the best!!!
Submitted byAnonymous (not verified)on Thu, 09/10/2009 - 12:35

In reply to by ericyeoh

it is compatible with your modem, just be sure to change the sample codes, like mscomm setting, comport number etc.. tnx for reading my article . all the best!!!

with MSComm1 .CommPort = 3 ' Com4 Port 'change this .Settings = "115200,n,8,1" 'Change this according to your modem .InputLen = 0 .PortOpen = True .Output = "AT" & Chr$(13) & Chr(10) .Output = "AT+CMGF=1" & Chr$(13) & Chr(10) .Output = "AT+CMGS=" & Chr$(34) & "+639212279363" & Chr$(34) & Chr(13) & Chr(10) .Output = "Hello Emond " & Chr(26) .PortOpen = False End with

Thx for reply, If i using PIC 16f how should i write to the VB to control the when to send a SMS to the owner by using GSM modem. Can you help me on this? I'm using 2 serial port connection, 1 is for GSM and the other 1 is for my PIC

Sorry for late reply.. you can use another MSCOMM control in your project in order to talk to your PIC16f interface..The default MScomm is for Sending SMS and the other is for controlling your circuit.. For sample Serial programming interface please email me.. [email protected] thank You

I really thank to one who wrote this article. I have always been reading and writing texts like this in blogs. Also, I, as a daily writer, present my respects to everyone. I just watched videos like this in youtube. I research in all areas. I think people must first research before writing...
Submitted byAnonymous (not verified)on Wed, 09/23/2009 - 18:12

just kidding!! means Want to have Fun coding with guys shaing knowledge to fellowmen.. nice ang good
Submitted byAnonymous (not verified)on Fri, 09/25/2009 - 21:56

sending can be done , emond if wanna do receiving msg espially msg for incoming msg show in the text box how should i write i had no idea on the Msccom receiving event. can u help me on this?
Submitted byemondon Fri, 10/09/2009 - 10:01

In reply to by Anonymous (not verified)

I have the full project in Sending and Receiving SMS in Vb6 using a GSM/GPRS HSPDA Modem.. Let see if the codes is compatible with your modem Please email me.. tnx for your interest.. [email protected]

Can you tell me plz Any services are available send SMS (US,UK and also INDIA),Now i am ready to buy a SMS service, and also how to this service integrate? (OR) How to send sms US,UK and INDIA using This is my complete question
Submitted byemondon Thu, 11/19/2009 - 12:10

In reply to by Anonymous (not verified)

using System; using System.Collections.Generic; using System.Text; using System.IO.Ports; using System.Threading; namespace ReadSMSConsole { class Program { static SerialPort gsmSerialPort; static void Main(string[] args) { gsmSerialPort=new SerialPort("COM15"); gsmSerialPort.ReadTimeout=1800; gsmSerialPort.Open(); SendATCommand("AT+CMGF=1"); DisplayReceivedData(); SendATCommand("AT+CMGL=\"ALL\""); DisplayReceivedData(); Console.ReadKey(); } static void SendATCommand(string strAT) { gsmSerialPort.DiscardInBuffer(); Console.WriteLine(strAT); gsmSerialPort.WriteLine(strAT+"\r\n"); } static void DisplayReceivedData() { do { Console.WriteLine(gsmSerialPort.ReadLine()); }while(gsmSerialPort.BytesToRead!=0); } } }
Submitted byAnonymous (not verified)on Mon, 10/05/2009 - 14:35

edmond if i wanna send MMS , just to send only, how should i write in the vb code to send mms using GPRS modem. can you help me on this? Plzzz
Submitted byemondon Thu, 10/21/2010 - 21:39

In reply to by Anonymous (not verified)

Please email me.. i will create a sample in sending MMS in both vb6 and 2008.. tnx for your interest..

Submitted byAnonymous (not verified)on Tue, 10/13/2009 - 20:15

Hiii i am using teltonika GSM modem when i am trying to open port through c# code the application is hanging at port.Open();--->command please tell the solution how to change my PC settings to support the modem. It is also hanging when i am using hyperterminal.
Submitted byAnonymous (not verified)on Sun, 10/18/2009 - 00:22

Can u help me full turtorial / sample code with vb6. Example like this : when we receive new message then auto save message in log.text and then automatic forward that message to sender. 1. receive message then show the message on table form 2. receive message then automaticly save log.txt 3. receive messafe then auto answer or forward that message again to sender. Thanks for your help. Regard Shadowfax(indonesian)
Submitted byemondon Fri, 11/13/2009 - 10:19

In reply to by Anonymous (not verified)

I recommend that you use MS Access for your data storage. It is more easy to show in table form unlike using .txt file as file system. you can create a Table name RECEVED SMS with the fields Phonenum, date, time, etc. you may add timer as a trigger to your program that will repeatedly check the recordcount of your RECEIVED SMS , if the recconunt changed the recordset will move to the last record (the unread received sms) then it will execute a Auto_Send function that will send an SMS to the sender(phonenum field). regards,

Add new comment