Staging:CC31xx Email Demo Application sdk1.0

Overview and application details
This sample application demonstrates how CC3100 can be used to send an email over SMTP. The application configures CC3100 to connect w/ an SMTP server and sends email to it. SMTP server forwards it to the recipient's email-server and the recipient receives the email from his email-server using IMAP/POP3 and/or other proprietary protocol.

This wiki page is only applicable for CC3100-SDK v0.5.2 and upward releases. For documentation on older SDKs' examples, refer corresponding file in \cc3100-sdk\docs\examples\

Email application's sequence

 * Client first makes a TCP connection with SMTP server.
 * SMTP server replies back w/ response-code and greeting-message containing FQDN
 * HELO/EHLO – Client sends Hello Message to the server. ESMTP accepts EHLO
 * The SMTP server replies with Code 250 and Hello Message. ESMTP Server replies with SMTP extensions it supports such as Email maximum Size, authentication etc.
 * If SMTP server requires authentication, the client sends “auth login” followed by “Username” and “Password” encoded with proper encryption accepted by SMTP Server.


 * auth login
 * 334 VXNlcm5hbWU6


 * Client sends "Username" encoded with proper encryption accepted by SMTP server


 * a2F1c2hmmdmdmdmhbGt1a2thckBnhfjdhfdjjsksbWFpbC5jb20


 * Client sends "Password" encoded with proper encryption accepted by SMTP Server


 * 334 UGFzc3dvcmQ6
 * Mlklkdldldl21haWxhYjskjdkskjss2Mzc3M=


 * SMTP server replies with Authentication Success/Failure.


 * 535 Incorrect authentication data/ 235 Authentication Successful


 * SMTP client then sends From-Address


 * MAIL FROM: xyz@abc.com


 * SMTP client sends To-Address


 * RCPT TO: abc@ti.com


 * SMTP client sends DATA command


 * DATA


 * SMTP client sends email data.


 * SMTP server responds with the acknowledgement

Source Files briefly explained

 * 1) main - Initializes the device, connects to an access-point and configures the email
 * 2) email - Wrapper functions to connect to SMTP-Server and send the configured email. These functions are called from main
 * 3) base64 - Functions to convert the raw bytes in quasi-big-endian order to Base64 string

Usage
Prerequisite: This application requires an access-point with internet connectivity


 * Connect the board to a Windows-PC and configure the terminal-program for seeing the logs - [| CC31xx_&_CC32xx_Terminal_Setting_Wiki] has detailed instructions for configuring the terminal-program
 * Open config.h and change SSID_NAME, SEC_TYPE and PASSKEY as per your access-point properties - SimpleLink device will connect to this AP when the application is executed
 * Edit the same file and change values for DESTINATION_EMAIL, EMAIL_SUBJECT and EMAIL_MESSAGE for setting up the email properties
 * USER and PASS has source-email properties - Change these value if email has to be sent from a different email-address
 * Compile and run the application
 * See the self explanatory logs on the terminal-program's console. On success, below message will be displayed on the terminal and an email is sent to the destination email-ID

Limitations/Known Issues

 * The size of the message is currently 64.
 * Subject should be less that 30 characters
 * Destination email should be less that 30 characters.