Sending out an SMS in text mode

This post was written by Jeroen on January 8, 2009
Posted Under: SMS
This entry is part 1 of 17 in the series Sending out an SMS

As explained in a prevous post in this series, a GSM modem can let you send SMS messages from a PC. There are two basic ways to do this: text mode and PDU mode.

You can play around with your GSM modem using a terminal program like HyperTerminal (which came with Windows XP, but is no longer there in Windows Vista). The commands I mention can just be entered in the terminal window when connected to the modem. You can try the following basic commands, any modem should support these:

ATI Returns general modem identification
ATD<phone number> Dials the phone number you supplied (don’t enter the <> brackets)
ATH Hang-up the phone (useful after the previous command).

The following commands are specific for GSM modems. If you get an error response (e.g. ‘+ERR’), your modem probably isn’t a GSM modem or it doesn’t support the extensions specific for GSM modems.

AT+CGMI Returns the modem’s manufacturer
AT+CGMM Returns the modem’s model

 The command to find out which of the modes are supported by your GSM modem is ‘AT+CMGF=?’. Send this string to your modem (followed by a newline) and the phone will answer ‘0’ for PDU mode and ‘1’ for text mode or ‘0,1’ if it supports both modes.

If you want to send an SMS message in text mode your modem needs to support it and you need to make sure the modem is in text mode first. The command ‘AT+CMGF?’ will tell you which mode is currently active. The command ‘AT+CMGF=1’’ will set the mode in text mode (if supported).

In text mode sending a text message is easy. The command is:

AT+CMGS=<phone-number><CR>
Text to be sent<Crtl-Z>

The <CR> and <Ctrl-Z> refer to the enter key and the Control-Z key combination respectively. There are some details regarding character sets, but if you stick to normal alpha-numeric texts (without accents or special characters), it should work as expected.

A followup post will elaborate a little more on text mode.

Series Navigation
Tags: , ,

Reader Comments

hi. does anybody know which models support sending messages in text mode?

#1 
Written By emix on May 9th, 2009 @ 2:38 am

very helpful! I tried it on a Siemens TC65 gsm modem and it works. One note: I think you have misspelling error: it should be AT+CMGS and not AT+CNGS
Hope this helps!

#2 
Written By bouguss on July 6th, 2009 @ 5:34 am

Good catch; I fixed it. Thanks.

#3 
Written By Jeroen on July 6th, 2009 @ 9:23 am

hi can anybody tell me if an s m s message is the same as a flash message thankx in advance

#4 
Written By russell on September 2nd, 2009 @ 7:31 am

hi russell here again i meant to say an s m s message on an mobile
phone

#5 
Written By russell on September 2nd, 2009 @ 7:33 am

Russel,

A regular SMS message is stored in the recipient phone (or SIM) and the phone indicates a new message has arrived with an SMS icon. A flash message is different in 2 ways: first it is displayed directly on the recipients phone, second (and this depends on how it was sent) it may not be stored so that when you dismiss the message it is gone.

Jeroen

#6 
Written By Jeroen on September 2nd, 2009 @ 8:18 am

Typo:
The command to find out which of the modes are supported by your GSM modem is ‘AT+CMGF=?’.
Not ‘AT+GSMF=?’.

Thanks for your helpful site!!

#7 
Written By Marcel Anthonijsz on December 3rd, 2009 @ 3:06 pm

Thanks, I fixed it.

#8 
Written By Jeroen on December 4th, 2009 @ 1:58 pm

I sent a flash message from computer using a TC65 gsm/gprs modem to a Sony Ericsson F305 and to my surprise the phone asked if I wanted to save the message.
Standards are not followed by all!!!.
Regards
Franco
P.S. Most phones does not let you save the message!!!.

#9 
Written By Franco on November 15th, 2010 @ 5:57 pm

modem complaining of CMS ERROR 305, invalid text. i am using only normal alpha numeric. whats the problem

#10 
Written By Franko on February 4th, 2012 @ 6:31 am

Add a Comment

required, use real name
required, will not be published
optional, your blog address