Email (SMTP/POP3) Application Note

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Email(SMTP/POP3)

Application Note
Email(SMTP/POP3) Application Note

Document Title: Email(SMTP/POP3) Application Note


Version: 0.01
Date: 2015-02-10
Status: Release
Document ID: SIM7100_Email_Application_Note_V0.01.doc

General Notes
SIMCom offers this information as a service to its customers, to support application and engineering efforts
that use the products designed by SIMCom. The information provided is based upon requirements
specifically provided to SIMCom by the customers. SIMCom has not undertaken any independent search
for additional relevant information, including any information that may be in the customer’s possession.
Furthermore, system validation of this product designed by SIMCom within a larger electronic system
remains the responsibility of the customer or the customer’s system integrator. All specifications supplied
herein are subject to change.

Copyright
This document contains proprietary technical information which is the property of SIMCom Limited.,
copying of this document and giving it to others and the using or communication of the contents thereof,
are forbidden without express authority. Offenders are liable to the payment of damages. All rights reserved
in the event of grant of a patent or the registration of a utility model or design. All specification supplied
herein are subject to change without notice at any time.

Copyright © Shanghai SIMCom Wireless Solutions Ltd. 2010

SIM7100_Email_Application_Note_V0.01 1 2015-02-10
Email(SMTP/POP3) Application Note

Version History
Version Chapter Comments
V0.01 New Version

SIM7100_Email_Application_Note_V0.01 2 2015-02-10
Email(SMTP/POP3) Application Note

Contents
V e r s i o n H i s t o r y .................................................................................................................................. 2
C o n t e n t s ................................................................................................................................................... 3
Email(SMTP/POP3) Application Note ........................................................................................................ 4
1. Overview ................................................................................................................................................ 4
2. Call Commands ..................................................................................................................................... 6
3. SMTP Application ................................................................................................................................. 8
3.1 Parameter Configuration ..................................................................................................................... 8
3.2 Write/Send Email ................................................................................................................................. 8
3.3 Abort Email Application ...................................................................................................................... 9
4. POP3 Application .................................................................................................................................. 9
4.1 Parameter Configuration ..................................................................................................................... 9
4.2 Inquire New Email ............................................................................................................................... 9
4.3 Peek At New Email ............................................................................................................................. 10
4.4 Retrieve Email Without Delete ...........................................................................................................11
4.5 Retrieve Email With Delete ............................................................................................................... 12
4.6 Abort POP3 Application .................................................................................................................... 13
4.7 Read Email In File System................................................................................................................. 14
5. Conflict AT Commands....................................................................................................................... 15
Contact Us .................................................................................................................................................... 16

SIM7100_Email_Application_Note_V0.01 3 2015-02-10
Email(SMTP/POP3) Application Note

Email(SMTP/POP3) Application Note

1. Overview
Simple Mail Transfer Protocol (SMTP) is an internet standard for electronic mail (e-mail) transmission
across Internet Protocol (IP) networks, and it is a text-based protocol.
To sending an e-mail successfully, TE must set some mandatory parameters for SMTP client correctly,
such as SMTP server address, sender and recipient address. After the process of sending an e-mail is started,
SMTP Client will initiates a Transmission Control Protocol (TCP) session with the SMTP server to send
e-mail.

SMTP features:
 Support SMTP authentication basing on SMTP server.
 Multi-recipient: TO, CC and BCC.
 ASCII test as e-mail subject, up to 512 characters.
 ASCII test as e-mail body, up to 5120 characters.
 E-mail attachments from File System: total size up to 10MB or maximal number up to 10 files.
 Stop SMTP application and close TCP session directly.

SMTP URCs (Unsolicited Result Code)


+SMTP: OK TCP session is OK, and start sending e-mail.
+SMTP: SUCCESS Send e-mail successfully, and network is closed.
+SMTP: ONGOING Another e-mail is being sent.
+SMTP: PARAM ERROR Mandatory parameter is invalid.
+SMTP: NETWORK ERROR Network is unavailable for SMTP.
+SMTP: SERVER ERROR Invalid SMTP server, or network is bad for establishing
session or sending data to SMTP server.
+SMTP: AUTH REQUIRED SMTP server released the session, or SMTP server
rejects the operation with wrong response, or SMTP
server doesn’t give SMTP client a response in time.
+SMTP: AUTH REQUIRED Authentication is required by SMTP server.
+SMTP: AUTH ERROR SMTP server rejects the session because of bad user
name and password combination.
+SMTP: BAD RCPT Invalid recipient address, or SMTP server can’t forward
[ <recipient address>] this e-mail to the address.

SMTP elements to construct e-mail’s header


sender’s address and name, recipient’s address and name, mail subject, Real Time Clock (RTC) and
time-zone. It is recommended to set RTC and time-zone (refer to command +CCLK).

SIM7100_Email_Application_Note_V0.01 4 2015-02-10
Email(SMTP/POP3) Application Note

Post Office Protocol – Version 3 (POP3) is an application-layer internet standard protocol used by
local e-mail client (POP3 client) to retrieve and delete e-mail from a remote POP3 server over a TCP/IP
connection.

POP3 features:
 POP3 server authentication.
 Number and total size of new e-mails.
 Get e-mail ID size of each e-mail.
 Peek at e-mail’s header.
 Get and delete e-mail from POP3 server.
 Save e-mail and attachment basing on File System (Local storage or storage card).
 Read the latest e-mail directly, or read e-mail from File System.
 Stop POP3 application and close TCP session directly.

POP3 basic functionality:


 Inquire whether new e-mail has arrived but not retrieve it.
 Peek at e-mail whether it is worth retrieving (read mail header).
 Retrieve e-mail from POP3 server but not delete it on the server.
 Retrieve e-mail from POP3 server and delete it on the server.

POP3 URCs (Unsolicited Result Code)


+POP3: SUCCESS POP3 client gets an e-mail successfully.
+POP3: FAILURE POP3 client gets an e-mail unsuccessfully.
+POP3: NETWORK ERROR Invalid POP3 server, or network is bad to establish
session or sending data to POP3 server.
+POP3: SERVER ERROR POP3 server released the session, or POP3 server
rejects the operation with wrong response, or POP3
server doesn’t give POP3 client a response in time, or
POP3 client gives wrong e-mail’s ID.
POP3 client will not close the session.
+POP3: INVALID UN Invalid user name to log in POP3 server.
+POP3: INVALID UN/PWD Invalid user name and password combination to log in
POP3 server.
+POP3: FILE SYSTEM ERROR File system is bad for saving E-mail or attachment,
storage space isn’t enough, or storage card is pulled
out. If POP3 client encounters this error, POPE client
will close the session with POP3 server.

NOTE SMTP timer: 30 seconds, if expired, SMTP application will stop.


POP3 timer: 30 seconds, if expired, SMTP application will stop.

SIM7100_Email_Application_Note_V0.01 5 2015-02-10
Email(SMTP/POP3) Application Note

2. Call Commands
This section only lists e-mail(SMTP/POP3) related commands. Please refer to AT command document
to get detailed descriptions.

AT+SMTPSRV
Configure SMTP server, including server address and its port number.
E.g. AT+SMTPSRV="smtp.server.com",25

AT+SMTPAUTH
Configure if SMTP client provides user name and password SMTP server when access SMTP server.
If SMTP server requests authentication but SMTP client does not provide, Email will be sent with a
failed result.
E.g. AT+SMTPAUTH=0 >> No authentication reques.t
AT+SMTPAUTH=1,"un","pwd" >> SMTP server requests authentication.

AT+SMTPFROM
Configure sender’s mail address and present name, they are used to construct email header.
E.g. AT+SMTPFROM="[email protected]","mike"
AT+SMTPFROM="[email protected]" >> Only configure mail address.

AT+SMTPRCPT
Configure recipients’ mail address and name for each email.
E.g. AT+SMTPRCPT=0,0,"[email protected]","toname" >> First normal recipient
AT+SMTPRCPT=0,1,"[email protected]" >> Second normal recipient without name
AT+SMTPRCPT=0,0 >> Clear the first normal recipient
AT+SMTPRCPT=0 >> Clear all normail recipient
AT+SMTPRCPT=1,0,"[email protected]","ccname" >> First CC recipient
AT+SMTPRCPT=2,0,”[email protected]","bccname" >> Frist BCC recipient

AT+SMTPSUB
Write the subject for each mail.
E.g. AT+SMTPSUB="First email"

AT+SMTPBODY
Write the content for each mail.
E.g. AT+SMTPBODY="This is the first email!"

AT+SMTPFILE
Select files from current directory in file system (local space or storage card) as email’s attachments.
E.g. AT+SMTPFILE=1,"file1" >> Select "file1" as the first attachment
AT+SMTPFILE=2,"file2" >> Select "file2" as the second attachment
AT+SMTPFILE=1 >> Delete the first attachment
AT+SMTPFILE >> Delete all attachments (no attachment)

SIM7100_Email_Application_Note_V0.01 6 2015-02-10
Email(SMTP/POP3) Application Note

AT+SMTPSEND
Establish TCP session between SMTP client and server, construct and send email. URC "+SMTP:
SUCCESS" indicates a successful result. Command +SMTPSEND? can be used to inquire if SMTP client
is in idle state.

AT+SMTPSTOP
Force to stop the TCP session and then SMTP client is in idle state.

AT+POP3SRV
Configure POP3 server and access account.
E.g. AT+POP3SRV="pop3.server.com","un","pwd",110

AT+POP3IN
Establish TCP session and access POP3 server.

AT+POP3NUM
Inquire the number of unread emails and the total size of these unread emails.

AT+POP3LIST
List each email’s ID(from 1 to unread emails’ number) and size, or list specified email’s ID and size.

AT+POP3HDR
Get specified email’s header from POP3 server.

AT+POP3GET
Get specified email and save email’s attachments into directory "C:/Email" or “D:/Email” (depending
on the value of command +FSLOCA)

AT+POP3DEL
Mark the email and after POP3 client finishs the session normally, POP3 server will delete the
specified email.

AT+POP3OUT
Finish the session normally.

AT+POP3STOP
Force to finish the session.

AT+POP3READ
Return last or specified email’s header and content.

SIM7100_Email_Application_Note_V0.01 7 2015-02-10
Email(SMTP/POP3) Application Note

3. SMTP Application
3.1 Parameter Configuration
Host must configure mandatory parameters for SMTP client before SMTP application. The mandatory
parameters include <socket PDP context>, <server address>, <server port>, <authentication or not>,
<sender address> and <sender name>.
NOTE Only configure mandatory parameters once correctly, until reboot.

AT+CGSOCKCONT=1,"IP","3GNET","0.0.0.0",0,0
OK
AT+SMTPSRV="smtp.server.com",25
OK
AT+SMTPAUTH=1,"UserName","password"
OK
AT+SMTPFROM="[email protected]","PresentName"
OK

3.2 Write/Send Email


Commands +SMTPSUB, +SMTPBODY and +SMTPFILE are used to complete an email.
Command +SMTPSEND is used to send the email.
For multi-email, host can control SMTP client to repeat the same process for many times.

AT+SMTPRCPT=0,0,"[email protected]","ToName"
OK
AT+SMTPRCPT=1,0,"[email protected]","CcName"
OK
AT+SMTPSUB="First Email"
OK
AT+SMTPBODY="This is the first Email!"
OK
AT+FSCD=C:/Picture
+FSCD: C:/Picture/

OK
AT+FSLS
+FSLS: FILES:
20100202_100006.jpg
20100202_100016.jpg

OK

SIM7100_Email_Application_Note_V0.01 8 2015-02-10
Email(SMTP/POP3) Application Note

AT+SMTPFILE=1,"20100202_100006.jpg"
OK
AT+SMTPFILE=2,"20100202_100016.jpg"
OK
AT+SMTPSEND
+SMTP: OK

OK

+SMTP: SUCCESS

3.3 Abort Email Application


Commands +SMTPSUB, +SMTPBODY and +SMTPFILE are used to complete an email.
AT+SMTPRCPT=0,0,"[email protected]","ToName"
OK
AT+SMTPSUB="First Email"
OK
AT+SMTPBODY="This is the first Email!"
OK
AT+SMTPSEND
+SMTP: OK

OK
AT+SMTPSTOP
OK

4. POP3 Application
4.1 Parameter Configuration
Host must configure mandatory parameters for POP3 client before POP3 application. The mandatory
parameters include <socket PDP context>, <server address>, <server port>, <access user name>, <access
password> and <email location>.
NOTE Only configure mandatory parameters once correctly, until reboot.

AT+CGSOCKCONT=1,"IP","3GNET","0.0.0.0",0,0
OK
AT+POP3SRV="pop3.server.com","un","pwd",110
OK

4.2 Inquire New Email

SIM7100_Email_Application_Note_V0.01 9 2015-02-10
Email(SMTP/POP3) Application Note

There is no new email on POP3 server, so release the session directly.


NOTE If no operation for long time when the session is active, POP3 server may release the session.

AT+POP3IN
+POP3: SUCCESS

OK
AT+POP3NUM
+POP3: 0, 0

OK
AT+POP3OUT
+POP3: SUCCESS

OK

4.3 Peek At New Email


Peek at email whether it is worth retrieving, if all emails are not worth, release the session directly.

AT+POP3IN
+POP3: SUCCESS

OK
AT+POP3NUM
+POP3: 2 2134

OK
AT+POP3LIST=1
+POP3: 1, 1050

OK
AT+POP3HDR=1
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:11:30 +0800
Subject: First Test Email

OK
AT+POP3LIST=2
+POP3: 2, 1084

OK

SIM7100_Email_Application_Note_V0.01 10 2015-02-10
Email(SMTP/POP3) Application Note

AT+POP3HDR=2
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:16:27 +0800
Subject: Second Test Email

OK
AT+POP3OUT
+POP3: SUCCESS

OK

4.4 Retrieve Email Without Delete

AT+POP3IN
+POP3: SUCCESS

OK
AT+POP3NUM
+POP3: 2 2134

OK
AT+POP3LIST=1
+POP3: 1, 1050

OK
AT+POP3HDR=1
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:11:30 +0800
Subject: First Test Email

OK
AT+POP3LIST=2
+POP3: 2, 1084

OK
AT+POP3HDR=2
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:16:27 +0800
Subject: Second Test Email

OK

SIM7100_Email_Application_Note_V0.01 11 2015-02-10
Email(SMTP/POP3) Application Note

AT+FSLOCA=0
OK
AT+POP3GET=1
OK

+POP3: SUCCESS
C:/Email/100202110457/, EMAIL000.TXT
AT+POP3READ
Date: Tue, 9 Mar 2010 17:11:30 +0800
From: "FromName" <[email protected]>
To: "ToName" <[email protected]>
Subject: First Test Email

This is a test email with an attachment.

OK
AT+POP3OUT
+POP3: SUCCESS

OK

4.5 Retrieve Email With Delete

AT+POP3IN
+POP3: SUCCESS

OK
AT+POP3NUM
+POP3: 2 2134

OK
AT+POP3LIST=1
+POP3: 1, 1050

OK
AT+POP3HDR=1
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:11:30 +0800
Subject: First Test Email

OK

SIM7100_Email_Application_Note_V0.01 12 2015-02-10
Email(SMTP/POP3) Application Note

AT+POP3LIST=2
+POP3: 2, 1084

OK
AT+POP3HDR=2
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:16:27 +0800
Subject: Second Test Email

OK
AT+FSLOCA=0
OK
AT+POP3GET=1
OK

+POP3: SUCCESS
C:/Email/100202113456/, EMAIL000.TXT
AT+POP3READ
Date: Tue, 9 Mar 2010 17:11:30 +0800
From: "FromName" <[email protected]>
To: "ToName" <[email protected]>
Subject: First Test Email

This is a test email with an attachment.

OK
AT+POP3DEL=1
+POP3: SUCCESS

OK
AT+POP3OUT
+POP3: SUCCESS

OK

4.6 Abort POP3 Application

AT+POP3IN
+POP3: SUCCESS

OK

SIM7100_Email_Application_Note_V0.01 13 2015-02-10
Email(SMTP/POP3) Application Note

AT+POP3NUM
+POP3: 2 2134

OK
AT+POP3LIST=1
+POP3: 1, 1050

OK
AT+POP3HDR=1
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:11:30 +0800
Subject: First Test Email

OK
AT+POP3LIST=2
+POP3: 2, 1084

OK
AT+POP3HDR=2
From: "FromName" <[email protected]>
Date: Tue, 9 Mar 2010 17:16:27 +0800
Subject: Second Test Email

OK
AT+FSLOCA=0
OK
AT+POP3GET=1
OK
AT+POP3STOP
OK

4.7 Read Email In File System

AT+FSCD=C:/Email
+FSCD: C:/Email/

OK
AT+FSLS
+FSLS: SUBDIRECTORIES:
100202110457

SIM7100_Email_Application_Note_V0.01 14 2015-02-10
Email(SMTP/POP3) Application Note

100202113456

OK
AT+POP3READ=0,"100202110457/EMAIL000.TXT"
Date: Tue, 9 Mar 2010 17:11:30 +0800
From: "FromName" <[email protected]>
To: "FromName" <[email protected]>
Subject: First Test Email

This is a test email with an attachment.

OK

5. Conflict AT Commands
Following AT commands cannot be used with SMTP/POP3 AT commands together:
 TCP/IP AT commands
 MMS AT commands
 GPS AT commands

SIM7100_Email_Application_Note_V0.01 15 2015-02-10
Email(SMTP/POP3) Application Note

Contact Us
Shanghai SIMCom Wireless Solutions Ltd.
Add: Building A, SIM Technology Building, No.633, Jinzhong Road, Changning District
200335
Tel: +86 21 3252 3300
Fax: +86 21 3252 3301
URL: http:/www.sim.com/wm/

SIM7100_Email_Application_Note_V0.01 16 2015-02-10

You might also like