At commands to mail for gsm module

Here are some common AT commands used to send and receive SMS messages using a GSM module:

Sending SMS

  1. AT+CMGS=<recipient's phone number>: Send a SMS message to the specified recipient's phone number.
    • Example: AT+CMGS=1234567890
  2. AT+CMGS=<recipient's phone number>,<message>: Send a SMS message to the specified recipient's phone number with the specified message.
    • Example: AT+CMGS=1234567890,"Hello, World!"
  3. AT+CMSS=<message>: Send a SMS message with the specified message.
    • Example: AT+CMSS,"Hello, World!"

Receiving SMS

  1. AT+CNMI=<mode>: Set the mode for receiving SMS messages.
    • Example: AT+CNMI=2 (set to receive SMS messages in text mode)
  2. AT+CMGL=<index>: Read the SMS message with the specified index.
    • Example: AT+CMGL=1 (read the first SMS message)
  3. AT+CMGR=<index>: Read the SMS message with the specified index and display it.
    • Example: AT+CMGR=1

Other AT commands

  1. AT+CMGF=<mode>: Set the SMS message format (text or PDU).
    • Example: AT+CMGF=1 (set to text mode)
  2. AT+CMGDA=<command>: Send a command to the SMS center (SC).
    • Example: AT+CMGDA="DEL 1" (delete the first SMS message)
  3. AT+CMGD=<index>: Delete the SMS message with the specified index.
    • Example: AT+CMGD=1 (delete the first SMS message)

Error handling

  1. AT+CMEE=<mode>: Set the error mode for SMS commands.
    • Example: AT+CMEE=1 (set to display error messages)
  2. AT+CREG=<mode>: Set the registration mode for the GSM module.
    • Example: AT+CREG=2 (set to automatic registration)

Note: The exact AT commands and syntax may vary depending on the specific GSM module and its firmware. It's recommended to consult the module's documentation for specific usage and error handling.