Quectel GSM SMTP AT Commands Manual V1.2
Quectel GSM SMTP AT Commands Manual V1.2
GSM SMTP
AT Commands
GSM_SMTP_ATC_V1.2
GSM_SMTP_ATC_V1.2
Version 1.2
Date 2015-04-08
Status Release
l
General Notes
e
Quectel offers this information as a service to its customers, to support application and
t
engineering efforts that use the products designed by Quectel. The information provided is
c l
based upon requirements specifically provided to Quectel by the customers. Quectel has not
a
undertaken any independent search for additional relevant information, including any
e i
information that may be in the customer’s possession. Furthermore, system validation of this
t
product designed by Quectel within a larger electronic system remains the responsibility of
u
the customer or the customer’s system integrator. All specifications supplied herein are
n
subject to change.
Q ide
Copyright
This document contains proprietary technical information which is the property of Quectel
f
Limited. The copying of this document, distribution to others, and communication of the
contents thereof, are forbidden without express authority. Offenders are liable to the payment
n
of damages. All rights are reserved in the event of a patent grant or registration of a utility
model or design. All specification supplied herein are subject to change without notice at any
o
time.
C
Copyright © Quectel Wireless Solutions Co., Ltd. 2015
GSM_SMTP_ATC_V1.2 -1-
GSM_SMTP_ATC_V1.2
Contents
l
2.2.2. AT+QSMTPPWD Set the password for authentication ...................................... 6
e
2.2.3. AT+QSMTPADDR Set the email address of the sender ..................................... 6
t
2.2.4. AT+QSMTPNAME Set the sender’s name ........................................................ 7
l
2.2.5. AT+QSMTPSRV Set the address and port of SMTP server ............................... 8
c
2.2.6. AT+QSMTPDST Add or delete recipients ......................................................... 8
e ia
2.2.7. AT+QSMTPSUB Edit the subject of the email .................................................. 9
t
2.2.8. AT+QSMTPBODY Edit the content of the email............................................. 10
u
2.2.9. AT+QSMTPATT Add an attachment for the email ........................................... 11
n
2.2.10. AT+QSMTPDATT Delete an attachment ......................................................... 12
Q ide
2.2.11. AT+QSMTPCLR Clear all the configurations and contents of the email ......... 13
2.2.12. AT+QSMTPCFG SMTP configurations ........................................................... 14
2.2.13. AT+QSMTPPUT Send email ........................................................................... 14
3. Summary of Error Codes ............................................................................................................ 16
f
4. Examples ..................................................................................................................................... 17
n
4.1. Configure SMTP server..................................................................................................... 17
4.2. Configure the information of sender ................................................................................. 17
o
4.3. Add recipients.................................................................................................................... 17
4.4. Edit the content of the email.............................................................................................. 18
C
4.5. Add a file in UFS as attachment ........................................................................................ 19
4.6. Send email ......................................................................................................................... 19
GSM_SMTP_ATC_V1.2 -2-
GSM_SMTP_ATC_V1.2
0. Revision history
t el
e c ia l
u n t
Q ide
n f
Co
GSM_SMTP_ATC_V1.2 -3-
GSM_SMTP_ATC_V1.2
1. Introduction
Quectel Module provides an internal TCP/IP stack that is driven by AT commands and enables the
host application to easily access the internet service. It includes TCP service, UDP service, HTTP
service, FTP service and SMTP service, etc. This document is a reference guide to all the AT
commands and responses defined for SMTP service.
el
1.1. Reference
c t l
Table 1: Reference
e ia
SN Document name Remark
t
[1] Mxx_ATC The introduction of AT commands for Quectel Module
u n
[2] GSM_TCPIP_AN To introduce how to use the internal TCP/IP stack
[3] GSM_File_ATC To introduce the AT commands for the file system
Q ide
1.2. Terms and abbreviations
n f
Table 2: Terms and abbreviations
o
Abbreviation Description
APN Access Point Network
C
CSD Circuit Switched Data
FTP File Transfer Protocol
GPRS General Packet Radio Service
HTTP Hypertext Transfer Protocol
SMTP Simple Mail Transfer Protocol
TCP Transmission Control Protocol
UART Universal Asynchronous Receiver/Transmitter
UDP User Datagram Protocol
UFS User File Storage. Please refer to [3]
GSM_SMTP_ATC_V1.2 -4-
GSM_SMTP_ATC_V1.2
Command Description
AT+QSMTPUSER SET THE USER NAME FOR AUTHENTICATION
AT+QSMTPPWD SET THE PASSWORD FOR AUTHENTICATION
AT+QSMTPADDR SET THE EMAIL ADDRESS OF THE SENDER
l
AT+QSMTPNAME SET THE SENDER’S NAME
e
AT+QSMTPSRV SET THE ADDRESS AND PORT OF SMTP SERVER
t
AT+QSMTPDST ADD OR DELETE RECIPIENTS
l
AT+QSMTPSUB EDIT THE SUBJECT OF THE EMAIL
c
AT+QSMTPBODY EDIT THE CONTENT OF THE EMAIL
e ia
AT+QSMTPATT ADD AN ATTACHMENT FOR THE EMAIL
t
AT+QSMTPDATT DELETE AN ATTACHMENT
u
AT+QSMTPCLR CLEAR ALL THE CONFIGURATIONS AND CONTENTS OF THE
n
EMAIL
Q ide
AT+QSMTPCFG SMTP CONFIGURATIONS
AT+QSMTPPUT SEND EMAIL
f
2.2. Detailed description of AT commands for SMTP service
o n
2.2.1. AT+QSMTPUSER Set the user name for authentication
AT+QSMTPUSER Set the user name for authentication
C
Test Command Response
AT+QSMTPUSE +QSMTPUSER: "USER"
R=?
OK
Parameters
See Write Command.
Read Command Response
AT+QSMTPUSE +QSMTPUSER: "<user>"
R?
OK
Parameters
See Write Command.
Write Command Response
AT+QSMTPUSE If format is right and it is not sending a mail, response
GSM_SMTP_ATC_V1.2 -5-
GSM_SMTP_ATC_V1.2
R="<user>" OK
Otherwise response
ERROR
Parameters
<user> The user name for the authentication. The maximum
size of the parameter is 50.
Reference
l
AT+QSMTPPWD Set the Password for Authentication
e
Test Command Response
t
AT+QSMTPPW +QSMTPPWD: "PASSWORD"
c l
D=?
OK
e ia
Parameters
t
See Write Command.
u
Read Command Response
n
AT+QSMTPWD +QSMTPPWD: "<****>"
Q ide
?
OK
Parameters
f
See Write Command.
Write Command Response
n
AT+QSMTPPW If format is right and it is not sending email, response
D="<pwd>" OK
o
Otherwise response
C
ERROR
Parameters
<pwd> The password for the authentication. The maximum
size of the parameter is 50.
<****> Mask for the password
Reference
GSM_SMTP_ATC_V1.2 -6-
GSM_SMTP_ATC_V1.2
Parameters
See Write Command
l
AT+QSMTPAD If format is right and it is not sending email, response
DR="<addr>" OK
t e
Otherwise response
c l
ERROR
e ia
Parameters
u t
<addr> The email address of the sender.
n
Reference
Q ide
2.2.4. AT+QSMTPNAME Set the sender’s name
AT+QSMTPNAME Set the sender’s name
Test Command Response
f
AT+QSMTPNA +QSMTPNAME: "NAME"
n
ME=?
OK
o
Parameters
See Write Command
C
Read Command Response
AT+QSMTPNA +QSMTPNAME: "<name>"
ME?
OK
Parameters
See Write Command
Write Command Response
AT+QSMTPNA If format is right and it is not sending email, response
ME="<name>" OK
Otherwise response
ERROR
Parameters
GSM_SMTP_ATC_V1.2 -7-
GSM_SMTP_ATC_V1.2
l
See Write Command
e
Read Command Response
t
AT+QSMTPSRV OK
c l
?
+QSMTPSRV: "<srvAddr>",<port>
e ia
Parameters
t
See Write Command
u
Write Command Response
n
AT+QSMTPSRV If format is right and it is not sending email, response
Q ide
="<srvAddr>",< OK
port>
Otherwise, response
f
ERROR
n
Parameters
<srvAddr> The IP address or domain name of the SMTP server.
o
<port> The port of the SMTP server.
Reference
C
2.2.6. AT+QSMTPDST Add or delete recipients
AT+QSMTPDST Add or delete recipients
Test Command Response
AT+QSMTPDST +QSMTPDST: (0,1),(1-3),"ADDRESS"
=?
OK
Parameters
See Write Command
GSM_SMTP_ATC_V1.2 -8-
GSM_SMTP_ATC_V1.2
l
Otherwise, response
ERROR
t e l
Parameters
c
<mode> A numeric to indicate to add a recipient or delete a
a
recipient.
e i
0 delete
u t
1 add
n
<type> A numeric to indicate the type of the recipient.
1 receiver
Q ide
2 copy receiver
3 secret receiver
<e-addr> The email address of the recipient to add or delete.
f
<result> A numeric to indicate the result of the operation. If it is
a negative numeric, it is the type of error (Please refer
n
to the chapter 3). If it is 0, it means the operation is
X X
o
successful.
Reference Note:
C
If <mode>equals 0, i.e. try to delete recipients, then if <e-addr> is default,
this command will delete all the recipients whose type is same as what
<type> defines, and then if <type> is also default, this command will delete
all the recipients. The maximum number of the recipients is 20.
GSM_SMTP_ATC_V1.2 -9-
GSM_SMTP_ATC_V1.2
l
ERROR
e
Parameters
t l
<charset> A numeric to indicate the character set of the title.
c
0 ASCII
a
1 UTF-8
e i
2 GB2312
u t
3 BIG5
n
<title> A string as the title of the email. If <charset> is 0, this
string will be as the title of the email. Otherwise, it is
Q ide
formatted as a hexadecimal number string, e.g. “41”
means the HEX value 0x41. The length of <title> is
0-100 if the character set is ASCII. The length of
f
<title> is 0-200 if the character set is not ASCII.
Reference
o n
2.2.8. AT+QSMTPBODY Edit the content of the email
AT+QSMTPBODY Edit the content of the email
C
Test Command Response
AT+QSMTPBO +QSMTPBODY: (0-3),(1-48000)
DY=?
OK
Parameters
See Write Command
Write Command Response
AT+QSMTPBO If format is right and it is not sending email, response
DY=<charset> OK
[,<timeout>]
CONNECT
+QSMTPBODY: <result>
Otherwise, response
GSM_SMTP_ATC_V1.2 - 10 -
GSM_SMTP_ATC_V1.2
ERROR
Parameters
<charset> A numeric to indicate the character set of the title.
0 ASCII
1 UTF-8
2 GB2312
3 BIG5
<timeout> The maximum time to download email body from
UART. The unit is second. If it is default, the maximum
time is infinite.
l
<result> A numeric to indicate the result to input email body. If
it is a negative numeric, it is the same as <err> (Please
t e
refer to the chapter 3). If is not a negative numeric, it
X X
l
represents the length of the input email body data.
c
Reference Note:
a
1. "+++" is used to end downloading email body.
e i
2. The maximum size of the email body is 10 Kbytes.
u n t
2.2.9. AT+QSMTPATT Add an attachment for the email
Q ide
AT+QSMTPATT Add an attachment for the email
Test Command Response
AT+QSMTPATT +QSMTPATT: "FILE NAME",<fileSz>,(1-48000)
=?
f
OK
n
Read Command Response
AT+QSMTPATT [+QSMTPATT: <fileIndex>,"<fileName>", <fileSz><CR><LF>……]
o
?
OK
C
Parameters
See Write Command
Write Command Response
AT+QSMTPATT If format is right and it is not sending email, response
="<fileName>"[, OK
<fileSz>,<timeou
t>] If the data of the attachment fill will be input via UART and the UART
enters data mode successfully, response
CONNECT
GSM_SMTP_ATC_V1.2 - 11 -
GSM_SMTP_ATC_V1.2
Parameters
<fileIndex> The index of the attachment.
<fileName> A string as the file name of the attachment to add. If it
is started with "/UFS/", it will get the specified file in
UFS as the attachment. And in M33, it is also supported
to get the file in the directory of "Picture" of SD and
RAM as the attachment, but it is necessary to add
"/SD/" before the file name for the file in the directory
"Picture" of SD card and "/RAM/" before the filename
for the file in RAM.
l
<fileSz> the size of the attachment to add. The range is
0-102400. The unit is byte. For the file in UFS or SD or
t e
RAM, this parameter is default and the size of the
l
attachment is the real size of the file to attach.
c
<timeout> the maximum time to download email attachment from
a
UART. The unit is second. If it is default, the maximum
e i
time is infinite. The range is 1-48000. The unit is
u t
second. For the file in UFS or SD or RAM, this
n
parameter is default.
<result> A numeric to indicate the result to input the attachment.
Q ide
If it is a negative numeric, it is the same as <err>
(Please refer to the chapter 3). If is not a negative
X X
f
Reference Note:
1. "+++" is used to end downloading attachment
n
2. The total number of the attachments should be no more than 10.
o
3. The total size of the attachments should be not greater than 100 Kbytes.
This restriction is only the attachments input from UART.
C
2.2.10. AT+QSMTPDATT Delete an attachment
AT+QSMTPDATT Delete an attachment
Test Command Response
AT+QSMTPDA +QSMTPDATT: (1-10)
TT=?
OK
Execute Response
Command If format is right and it is not sending email, response
AT+QSMTPDA OK
TT
+QSMTPDATT: <result>
Otherwise, response
ERROR
GSM_SMTP_ATC_V1.2 - 12 -
GSM_SMTP_ATC_V1.2
Parameters
See Write Command
Write Command Response
AT+QSMTPDA If format is right and it is not sending email, response
TT=<fileIndex> OK
+QSMTPDATT: <result>
Otherwise, response
ERROR
Parameters
l
<fileIndex> The index of the attachment to delete. Please refer to
<fileIndex> in 2.2.9
e
X X
t
<result> A numeric to indicate the result to delete the
l
attachment. If it is 0, it means it is successful to delete
c
the attachment. If it is a negative numeric, it is the
a
same as <err> (Please refer to the chapter 3).
e i
X X
t
Reference Note:
u
The Execute Command is used to delete all the attachments.
Q ide n
2.2.11. AT+QSMTPCLR Clear all the configurations and contents of the email
AT+QSMTPCLR Clear all the configurations and contents of the email
Test Command Response
f
AT+QSMTPCL OK
R=?
n
Execute If format is right, response
Command OK
o
AT+QSMTPCL
R Otherwise, response
C
ERROR
Reference Note:
The execute command will clear the following configurations and contents.
1. user name (refer to the command AT+QSMTPUSER)
2. password (refer to the command AT+QSMTPPWD)
3. the sender’s address (refer to the command AT+QSMTPADDR)
4. the sender’s name (refer to the command AT+QSMTPNAME)
5. the address of the SMTP server (refer to the command
AT+QSMTPSRV)
6. all the recipients (refer to the command AT+QSMTPDST)
7. the subject (refer to the command AT+QSMTPSUB)
8. the body (refer to the command AT+QSMTPBODY)
9. all the attachments (refer to the command AT+QSMTPATT)
GSM_SMTP_ATC_V1.2 - 13 -
GSM_SMTP_ATC_V1.2
l
Else
e
If format is right and it is not sending email, response
t
OK
l
Otherwise, response
c
ERROR
e t ia
Parameters
u
<type> A numeric to indicate the parameter to configure.
n
1 configure whether need authentication
Q ide
<value> the value of the parameter to configure defined by
<type>.
If <type> == 1
0 don’t need authentication
f
1 need authentication. This is factory default value.
n
Reference Note:
The Write Command with <value> omitted is used to query the value of the
o
corresponding parameter.
C
2.2.13. AT+QSMTPPUT Send email
AT+QSMTPPUT Send email
Test Command Response
AT+QSMTPPU +QSMTPPUT: (100-48000)
T=?
OK
Execute If format is right and it is not sending email, response
Command OK
AT+QSMTPPU
T +QSMTPPUT: <result>
Otherwise, response
ERROR
Note: This means the module will try to send the email without time
GSM_SMTP_ATC_V1.2 - 14 -
GSM_SMTP_ATC_V1.2
restriction.
Write Command Response
AT+QSMTPPU If format is right and it is not sending email, response
T=<timeout> OK
+QSMTPPUT: <result>
Otherwise, response
ERROR
Parameters
<timeout> the maximum time to send email. The unit is second. If
l
it is default, the maximum time is infinite. The range is
100-48000.
t e
<result> A numeric to indicate the result to send the email. If it
l
is 0, it means it is successful to send the mail. If it is a
c
negative numeric, it is the same as <err> (Please refer
a
to the chapter 3).
e i
X X
t
Reference
u
Q ide n
n f
Co
GSM_SMTP_ATC_V1.2 - 15 -
GSM_SMTP_ATC_V1.2
The error code <err> indicates an error related to mobile equipment or network. The detail about
<err> is described in the following table.
<err> Meaning
-1 Unknown error
-3 The SMTP service is busy. Such as, downloading body or attachment,
sending email
l
-4 Failed to get IP address according to domain name
-5 Network error. Such as, failed to activate GPRS/CSD context, failed to
e
establish the TCP connection with the SMTP server or failed to send email
t
to the SMTP server, etc.
c l
-6 Unsupported authentication type
a
-7 The connection for the SMTP service is closed by peer.
e i
-8 GPRS/CSD context is deactivated
u t
-9 Timeout
n
-10 No recipient for the SMTP service
-11 Failed to send email
Q ide
-12 Failed to open file for attachment
-13 No enough memory for the attachment
-14 Failed to save the attachment
f
-15 The input parameter is wrong
n
-421 Service not available, closing transmission channel
-450 Requested mail action not taken: mailbox unavailable
o
-451 Requested action aborted: local error in processing
-452 Requested action not taken: insufficient system storage
C
-500 Syntax error, command unrecognized
-501 Syntax error in parameters or arguments
-502 Command not implemented
-503 Bad sequence of commands
-504 Command parameter not implemented
-521 <domain> does not accept mail (see rfc1846)
-530 Access denied
-535 Authentication failed
-550 Requested action not taken: mailbox unavailable
-551 User not local; please try <forward-path>
-552 Requested mail action aborted: exceeded storage allocation
-553 Requested action not taken: mailbox name not allowed
-554 Transaction failed
GSM_SMTP_ATC_V1.2 - 16 -
GSM_SMTP_ATC_V1.2
4. Examples
l
OK
e
AT+QSMTPPWD="test" // Set the password for authentication as "test"
t
OK
c a l
Note:
e i
Actually, the user name "quectel" and password "test" isn’t a valid account. It is just an
u t
example.
Q ide n
4.2. Configure the information of sender
f
OK
n
AT+QSMTPADDR="[email protected]" // Set the email address of the sender as
o
"[email protected]"
OK
OK
C
4.3. Add recipients
By the way, if you find the recipient you added before is wrong and you want to delete it, please
execute the following command.
el
AT+QSMTPBODY=1, 10 // Prepare to input the content of the email from UART.
t
And the character set of the email body is UTF-8
l
which is defined by 1.
c
OK
e t ia
CONNECT
u
…… // Input the data of the email body
n
+++ // Input "+++" to end downloading email body
Q ide
+QSMTPBODY: 2009 // Successful to download email body and the size of
the email body is 2009.
AT+QSMTPATT="bigfile.txt" // Prepare to download the attachment "bigfile.txt"
OK
n f
CONNECT
…… // Input the data of the attachment
o
+++ // Input "+++" to end downloading the attachment
+QSMTPATT: 20090 // Successful to download the attachment and the size
C
of the attachment is 20090.
OK
By the way, if you don’t want send the attachment with the email, please delete the attachment by
the following command.
It is supported to add a file in UFS as the attachment of the email. And the following is an
example to add a file in UFS as the attachment.
AT+QSMTPATT="/UFS/attach.txt" // Add the file "attach.txt" in UFS as attachment.
OK
l
+QSMTPATT: 1,"bigfile.txt", 20090 // The first attachment is "bigfile.txt" and its
e
size is 20090.
t
+QSMTPATT: 2,"/UFS/attach.txt", 20100 // The second attachment is "attach.txt" in UFS
l
and its size is 20100.
e c ia
OK
u t
In M33, it is supported to add the files in SD and RAM. And the method to add the file in SD or
n
RAM is almost the same as the method to add the file in UFS except replacing "/UFS/" with
Q ide
"/SD/" or "/RAM/".
f
AT+QIFGCNT=0 // Choose the context 0 to activate GPRS/CSD
n
context for the SMTP service, please refer to [1] and
o
[2]
OK
C
AT+QICSGP=1,”CMNET” // Choose GPRS mode and set the APN as
"CMNET"
OK
GSM_SMTP_ATC_V1.2 - 19 -
Quectel Wireless Solutions Co., Ltd.
Room 501, Building 9, No.99, Tianzhou Road, Shanghai, China 200233
Tel: +86 21 5108 2965
Mail: [email protected]
H H