Deleting SMS Messages from Message Storage (AT+CMGD)
The AT command +CMGD (command name in text: Delete Message) is used to delete SMS message(s) from message storage. The message storage area from which SMS messages are deleted is specified by the +CPMS AT command (command name in text: Preferred Message Storage).
AT+CMGD=index[,flag]
AT+CMGD=index[,flag]
The SMS specification has defined these flag values: 0, 1, 2, 3 and 4.
- 0. Meaning: Delete only the SMS message stored at the location index from the message storage area. This is the default value.
- 1. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read" from the message storage area.
- 2. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read" or "stored sent" from the message storage area.
- 3. Meaning: Ignore the value of index and delete all SMS messages whose status is "received read", "stored unsent" or "stored sent" from the message storage area.
- 4. Meaning: Ignore the value of index and delete all SMS messages from the message storage area