AT Command

Description

AT+CMGD command is used to delete SMS messages.


Support

Module Tutorial

Examples

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

Try the below script in the AT Command Tester tool

//Script: at_cmgd.at
//Use this script to AT+cmgd AT command

//Get the command support
AT+cmgd=?

WAIT=2


//Delete SMS message at index 1
AT+cmgd=1

WAIT=1

//Delete SMS message at index 2
AT+cmgd=2


WAIT=1

//Delete SMS message at index 3
AT+cmgd=3

WAIT=1

//Delete all read messages SMS messages, leave unread 
//messages and stored MO messages untouched
AT+cmgd=,1


WAIT=1

//Delete all read messages SMS messages and sent Mobile
//originated messages, leave unread messages and unsent MO
//messages untouched
AT+cmgd=,2

WAIT=1

//Delete all read messages SMS messages. sent and unsent
//Mobile originated messages, leave unread messages untouched
AT+cmgd=,3

WAIT=1

//Delete all messages including unread messages
AT+cmgd=,4

WAIT=1

Output of the above script in the AT Command Tester tool tool.

AT+cmgd=?

+CMGD: (0,1,2),(0-4)

OK
AT+cmgd=1

OK
AT+cmgd=2

OK
AT+cmgd=3

OK
AT+cmgd=,1

OK
AT+cmgd=,2

OK
AT+cmgd=,3

OK
AT+cmgd=,4

OK