AT+CMGL - List Received Messages in Text Mode
The AT+CMGL command lists messages received on the GSM modem. It can be used to get all received messages, all unread messages or all read messages.
| Command | Positive Response |
|---|---|
| AT+CMGL=<stat><CR> | +CMGL: <index>,<stat>,<oa>,[<alpha>],[<scts>]<CR><LF><data><CR><LF> ... OK |
Parameters
<stat>: Status = "ALL", "REC UNREAD" or "REC READ"
<index>: Index number of the message
<oa>: Originator address
<alpha>: Originator name (if available in the phonebook)
<scts>: Service Center Time Stamp
<data>: The content of the text message
<CR>: ASCII character 13
<LF>: ASCII character 10
Example
Set the GSM modem to Text Mode SMS, list all received messages and remove the messages from the GSM modem.
<code>AT+CMGF=1 OK AT+CMGL="ALL" +CMGL: 1,"REC UNREAD","+31628870634",,"11/01/09,10:26:26+04" This is text message 1 +CMGL: 2,"REC UNREAD","+31628870634",,"11/01/09,10:26:49+04" This is text message 2 OK AT+CMGD=1 OK AT+CMGD=2 OK </code>
See also
AT+CMGF - Set SMS Text Mode or SMS PDU Mode
AT+CMGD - Delete a Received Message