Reference Home

MAIL

Description

Derived class of WiFi. This class implements a simple version of the SMTP protocol.
Note that the implemented protocol is not TLS (no STARTTLS or SSL/TLS ). No port 587 or 465. Just port 25. For example smtp.gmail.com (173.194.70.108) is not usable.

Unfortunately, a lot of SMTP server uses secure protocol, but it is quite hard developing TLS symmetric cryptography in Arduino because its very poor RAM. Anyway, especially second form of sendMail function (authenticate protocol with user name and password) can be used with servers that don't use TLS. User name and password are automatically coded using code64 protocol.

Syntax

MAIL.sendMail(char *SmtpServer,char *user,char *dest,char *subject,char *mess)

MAIL.sendMail(char *SmtpServer,char *user,char *psw,char *dest,char *subject,char *mess)

 

MAIL.setTimeout(int millis) // default 500

Parameters

SmtpServer : IP address of SmtpServer choosed. Example: 62.241.4.1 (relay.poste.it)

user : mail address of sender. (usualy used also as user name in authentication process)

psw : password (second form)

dest : mail address of destination

subject : subject header

mess : message (no special character) (only ASCII)

Returns

boolean : true if sent ; false otherwise

Example:

#include <MAIL.h> //library include

 

MAIL WIFI; //instance of MAIL (derived class of MWiFi)

 

void setup() {
    WIFI.begin(); // startup shield
:
:

WIFI.sendMail("111.111.111.111","john@gmail.com","pppppp","marc@yahoo.com","Sample","Just to test"

}

void loop() {}

Reference Home