Microchip® Advanced Software Framework

common/components/wifi/winc3400/send_email_example/main.h File Reference

MAIN configuration.

Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.

Macros

#define IPV4_BYTE(val, index)   ((val >> (index * 8)) & 0xFF)
 Using IP address. More...
 
#define MAIN_EMAIL_MSG   "This mail is sent from Send Email Example."
 
#define MAIN_EMAIL_SUBJECT   "Hello from WINC3400!"
 
#define MAIN_FROM_ADDRESS   "sender@gmail.com" /* Set From Email Address */
 
#define MAIN_FROM_PASSWORD   "12345678" /* Set Sender Email Password */
 
#define MAIN_GMAIL_HOST_NAME   "smtp.gmail.com"
 
#define MAIN_GMAIL_HOST_PORT   465
 
#define MAIN_RECIPIENT_RFC   "<recipient@gmail.com>" /* Set Recipient Email Address */
 
#define MAIN_RETRY_COUNT   3
 
#define MAIN_SENDER_RFC   "<sender@gmail.com>" /* Set Sender Email Address */
 
#define MAIN_SMTP_BUF_LEN   1024
 All SMTP defines. More...
 
#define MAIN_TO_ADDRESS   "recipient@gmail.com" /* Set To Email Address */
 
#define MAIN_WAITING_TIME   30000
 
#define MAIN_WLAN_AUTH   M2M_WIFI_SEC_WPA_PSK
 Security type. More...
 
#define MAIN_WLAN_PSK   "12345678"
 Password for Destination SSID. More...
 
#define MAIN_WLAN_SSID   "DEMO_AP"
 Wi-Fi Settings. More...
 

Enumerations

enum  eMainEmailError {
  MAIN_EMAIL_ERROR_FAILED = -1,
  MAIN_EMAIL_ERROR_NONE = 0,
  MAIN_EMAIL_ERROR_INIT,
  MAIN_EMAIL_ERROR_HELO,
  MAIN_EMAIL_ERROR_AUTH,
  MAIN_EMAIL_ERROR_AUTH_USERNAME,
  MAIN_EMAIL_ERROR_AUTH_PASSWORD,
  MAIN_EMAIL_ERROR_FROM,
  MAIN_EMAIL_ERROR_RCPT,
  MAIN_EMAIL_ERROR_DATA,
  MAIN_EMAIL_ERROR_MESSAGE,
  MAIN_EMAIL_ERROR_QUIT,
  MAIN_EMAIL_ERROR_FAILED = -1,
  MAIN_EMAIL_ERROR_NONE = 0,
  MAIN_EMAIL_ERROR_INIT,
  MAIN_EMAIL_ERROR_HELO,
  MAIN_EMAIL_ERROR_AUTH,
  MAIN_EMAIL_ERROR_AUTH_USERNAME,
  MAIN_EMAIL_ERROR_AUTH_PASSWORD,
  MAIN_EMAIL_ERROR_FROM,
  MAIN_EMAIL_ERROR_RCPT,
  MAIN_EMAIL_ERROR_DATA,
  MAIN_EMAIL_ERROR_MESSAGE,
  MAIN_EMAIL_ERROR_QUIT
}
 
enum  eSMTPStatus {
  SMTP_INACTIVE = 0,
  SMTP_INIT,
  SMTP_HELO,
  SMTP_AUTH,
  SMTP_AUTH_USERNAME,
  SMTP_AUTH_PASSWORD,
  SMTP_FROM,
  SMTP_RCPT,
  SMTP_DATA,
  SMTP_MESSAGE_SUBJECT,
  SMTP_MESSAGE_TO,
  SMTP_MESSAGE_FROM,
  SMTP_MESSAGE_CRLF,
  SMTP_MESSAGE_BODY,
  SMTP_MESSAGE_DATAEND,
  SMTP_QUIT,
  SMTP_ERROR,
  SMTP_INACTIVE = 0,
  SMTP_INIT,
  SMTP_HELO,
  SMTP_AUTH,
  SMTP_AUTH_USERNAME,
  SMTP_AUTH_PASSWORD,
  SMTP_FROM,
  SMTP_RCPT,
  SMTP_DATA,
  SMTP_MESSAGE_SUBJECT,
  SMTP_MESSAGE_TO,
  SMTP_MESSAGE_FROM,
  SMTP_MESSAGE_CRLF,
  SMTP_MESSAGE_BODY,
  SMTP_MESSAGE_DATAEND,
  SMTP_QUIT,
  SMTP_ERROR
}
 
enum  eSocketStatus {
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError,
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError,
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError,
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError,
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError,
  SocketInit = 0,
  SocketConnect,
  SocketWaiting,
  SocketComplete,
  SocketError
}
 

Variables

const char cSmtpCodeAuthReply [] = {'3', '3', '4', '\0'}
 
const char cSmtpCodeAuthSuccess [] = {'2', '3', '5', '\0'}
 
const char cSmtpCodeIntermedReply [] = {'3', '5', '4', '\0'}
 
const char cSmtpCodeOkReply [] = {'2', '5', '0', '\0'}
 
const char cSmtpCodeReady [] = {'2', '2', '0', '\0'}
 Return Codes. More...
 
const char cSmtpCrlf [] = "\r\n"
 
const char cSmtpData [] = "DATA"
 
const char cSmtpDataEnd [] = {'\r', '\n', '.', '\r', '\n', '\0'}
 
const char cSmtpFrom [] = "From: "
 
const char cSmtpHelo [] = {'H', 'E', 'L', 'O', '\0'}
 Send Codes. More...
 
const char cSmtpMailFrom [] = {'M', 'A', 'I', 'L', ' ', 'F', 'R', 'O', 'M', ':', ' ', '\0'}
 
const char cSmtpQuit [] = {'Q', 'U', 'I', 'T', '\r', '\n', '\0'}
 
const char cSmtpRcpt [] = {'R', 'C', 'P', 'T', ' ', 'T', 'O', ':', ' ', '\0'}
 
const char cSmtpSubject [] = "Subject: "
 
const char cSmtpTo [] = "To: "
 

#define IPV4_BYTE (   val,
  index 
)    ((val >> (index * 8)) & 0xFF)

Using IP address.

#define MAIN_EMAIL_MSG   "This mail is sent from Send Email Example."
#define MAIN_EMAIL_SUBJECT   "Hello from WINC3400!"
#define MAIN_FROM_ADDRESS   "sender@gmail.com" /* Set From Email Address */
#define MAIN_FROM_PASSWORD   "12345678" /* Set Sender Email Password */
#define MAIN_GMAIL_HOST_NAME   "smtp.gmail.com"
#define MAIN_GMAIL_HOST_PORT   465
#define MAIN_RECIPIENT_RFC   "<recipient@gmail.com>" /* Set Recipient Email Address */
#define MAIN_RETRY_COUNT   3
#define MAIN_SENDER_RFC   "<sender@gmail.com>" /* Set Sender Email Address */
#define MAIN_SMTP_BUF_LEN   1024

All SMTP defines.

#define MAIN_TO_ADDRESS   "recipient@gmail.com" /* Set To Email Address */
#define MAIN_WAITING_TIME   30000
#define MAIN_WLAN_AUTH   M2M_WIFI_SEC_WPA_PSK

Security type.

#define MAIN_WLAN_PSK   "12345678"

Password for Destination SSID.

#define MAIN_WLAN_SSID   "DEMO_AP"

Wi-Fi Settings.

Destination SSID

Enumerator
MAIN_EMAIL_ERROR_FAILED 
MAIN_EMAIL_ERROR_NONE 
MAIN_EMAIL_ERROR_INIT 
MAIN_EMAIL_ERROR_HELO 
MAIN_EMAIL_ERROR_AUTH 
MAIN_EMAIL_ERROR_AUTH_USERNAME 
MAIN_EMAIL_ERROR_AUTH_PASSWORD 
MAIN_EMAIL_ERROR_FROM 
MAIN_EMAIL_ERROR_RCPT 
MAIN_EMAIL_ERROR_DATA 
MAIN_EMAIL_ERROR_MESSAGE 
MAIN_EMAIL_ERROR_QUIT 
MAIN_EMAIL_ERROR_FAILED 
MAIN_EMAIL_ERROR_NONE 
MAIN_EMAIL_ERROR_INIT 
MAIN_EMAIL_ERROR_HELO 
MAIN_EMAIL_ERROR_AUTH 
MAIN_EMAIL_ERROR_AUTH_USERNAME 
MAIN_EMAIL_ERROR_AUTH_PASSWORD 
MAIN_EMAIL_ERROR_FROM 
MAIN_EMAIL_ERROR_RCPT 
MAIN_EMAIL_ERROR_DATA 
MAIN_EMAIL_ERROR_MESSAGE 
MAIN_EMAIL_ERROR_QUIT 
Enumerator
SMTP_INACTIVE 
SMTP_INIT 
SMTP_HELO 
SMTP_AUTH 
SMTP_AUTH_USERNAME 
SMTP_AUTH_PASSWORD 
SMTP_FROM 
SMTP_RCPT 
SMTP_DATA 
SMTP_MESSAGE_SUBJECT 
SMTP_MESSAGE_TO 
SMTP_MESSAGE_FROM 
SMTP_MESSAGE_CRLF 
SMTP_MESSAGE_BODY 
SMTP_MESSAGE_DATAEND 
SMTP_QUIT 
SMTP_ERROR 
SMTP_INACTIVE 
SMTP_INIT 
SMTP_HELO 
SMTP_AUTH 
SMTP_AUTH_USERNAME 
SMTP_AUTH_PASSWORD 
SMTP_FROM 
SMTP_RCPT 
SMTP_DATA 
SMTP_MESSAGE_SUBJECT 
SMTP_MESSAGE_TO 
SMTP_MESSAGE_FROM 
SMTP_MESSAGE_CRLF 
SMTP_MESSAGE_BODY 
SMTP_MESSAGE_DATAEND 
SMTP_QUIT 
SMTP_ERROR 
Enumerator
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 
SocketInit 
SocketConnect 
SocketWaiting 
SocketComplete 
SocketError 

const char cSmtpCodeAuthReply[] = {'3', '3', '4', '\0'}
const char cSmtpCodeAuthSuccess[] = {'2', '3', '5', '\0'}
const char cSmtpCodeIntermedReply[] = {'3', '5', '4', '\0'}
const char cSmtpCodeOkReply[] = {'2', '5', '0', '\0'}
const char cSmtpCodeReady[] = {'2', '2', '0', '\0'}

Return Codes.

const char cSmtpCrlf[] = "\r\n"
const char cSmtpData[] = "DATA"
const char cSmtpDataEnd[] = {'\r', '\n', '.', '\r', '\n', '\0'}
const char cSmtpFrom[] = "From: "
const char cSmtpHelo[] = {'H', 'E', 'L', 'O', '\0'}

Send Codes.

const char cSmtpMailFrom[] = {'M', 'A', 'I', 'L', ' ', 'F', 'R', 'O', 'M', ':', ' ', '\0'}
const char cSmtpQuit[] = {'Q', 'U', 'I', 'T', '\r', '\n', '\0'}
const char cSmtpRcpt[] = {'R', 'C', 'P', 'T', ' ', 'T', 'O', ':', ' ', '\0'}
const char cSmtpSubject[] = "Subject: "
const char cSmtpTo[] = "To: "