AT Command

Description

AT+CMGS At command is used to send SMS message. The messages can be sent in the text mode or PDU mode.


Support

Module Tutorial

Examples

AT+CMGS="858xxxxxxx"
> Test Message with AT Command Tester
+CMGS: 20
OK

KeywordsAT+CMGS syntax, examples, parameters, error, input, response.

See SMS Tutorial

With Online AT Command Tester tool,, you can view/list/delete SMS messages stored on the device. You can also send SMS message to a mobile device.

SMS send message

SMS messages can be sent in text mode or PDU mode. To determine thw current configuration,

AT+CMGS – Text Mode

//SMS message is set for Text Mode
AT+CMGF?
+CMGF: 1
OK

//In text mode, the format to send SMS is
AT+CMGS=”858xxxxxxx”
> Test Message with AT Command Tester
+CMGS: 20
OK

AT+CMGS – PDU Mode
//SMS message is set for PDU Mode
AT+CMGF?
+CMGF: 0
OK

//Format to send SMS message in PDU mode,
Here is an example of sending SMS in PDU mode
AT+CMGS=24
>079179521201009511FF0B917962543940F20008001400410042004300440045
+CMGS: 128
OK

Fields of SMS PDU message format
PDU message format
Length of SMSC information –
Type of address of SMSC
SMSC number
First octet of SMS-DELIVER messager
Length of teh sender address
Sender Number
Protocol indentifier
Data encoding scheme
Time stamp
Length of user data
User data



Try this script included in AT Command Tester Tool.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Script-at+cmgs.at

//Test AT+CMGS command

//AT+CMGS command is used to send SMS

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

//List of supported responses

AT+CMGF=?

 

//WAIT for 1 sec

WAIT=1

 

//Get the current SMS Mode

// 0 - PDU Mode, 1- Text Mode,

AT+CMGF?

 

//WAIT for 1 sec

WAIT=1

 

//Check whether device is registered

//If device is not registered, SMS cannot be sent

AT+CREG?

 

//First let us send SMS in text mode

AT+CMGF=1

 

//WAIT for 1 sec

WAIT=1

 

//Send the message. Set your To number below

AT+CMGS="8545579983"

 

//Wait for the > prompt

WAIT=2

 

//Type the SMS text below

This is my SMS message

 

//Send the CTRL+Z character. ^z is special command of AT Command Script engine.

^z

 

//WAIT for 4 sec

WAIT=4

 

//Send SMS in PDU mode

AT+CMGF=0

 

//WAIT for 1 sec

WAIT=1

 

//Send the message. Set your To number below

//Use the SMS tab in AT Command Tester tool to get PDU formatted message.

AT+CMGS=44

 

//Wait for the > prompt

WAIT=2

 

//Send the PDU formatted message

0011000A8158585555550000aa23D4F29C0E6A97E7F3F0B90C32CBDF6D50900A1ABEDBEDB09B0CA296E7F4B21C

 

//Wait for the > prompt

WAIT=2

 

//Send the CTRL+Z character. ^z is special command of AT Command Script engine.

^z


Output of above script in AT Command Tester Tool.

 

AT+CMGF=?

+CMGF: (0,1)

 

OK

AT+CMGF?

+CMGF: 0

 

OK

SMS message for is configured for PDU mode

AT+CREG?

+CREG: 0,1

 

OK

The device is registered in home network.

 

AT+CMGF=1

OK

AT+CMGS="8545579983"

> This is my SMS message

>

>

+CMGS: 41

 

OK

AT+CMGF=0

OK

AT+CMGS=44

> 0011000A8158585555550000aa23D4F29C0E6A97E7F3F0B90C32CBDF6D50900A1ABEDBEDB09B0CA296E7F4B21C

>

>

+CMGS: 42

 

OK