Page 1 of 1

How to send a e-mail (ESP32-Arduino)

Posted: Tue Aug 01, 2017 3:55 pm
by Pyshco
On my project i need to send a e-mail when something happens, i dunno how to do it and i couldn't found documentation about that, can you guys help me?

Re: How to send a e-mail (ESP32-Arduino)

Posted: Tue Aug 01, 2017 4:19 pm
by tele_player
Email is sent using the SMTP protocol. There are libraries and examples, and the basic protocol isn't too difficult to implement.

But it's not that simple, most SMTP servers won't accept mail from a simple SMTP client implementation. They require authentication and TLS encryption. That makes it harder.

Probably better to use MQTT, and let a cloud-based MQTT broker handle sending email.

Re: How to send a e-mail (ESP32-Arduino)

Posted: Wed Aug 02, 2017 12:24 am
by gdsports
Alternatively, look at ifttt.com webhooks (previously known as maker channel). Send a trigger using http GET or POST from the ESP. TLS is optional. The HTTPClient library is helpful for this. When IFTTT receives the trigger, it can send email, SMS, tweet, etc.

Re: How to send a e-mail (ESP32-Arduino)

Posted: Wed Aug 02, 2017 9:28 am
by Gengus_Kahn
Hi there, I have used http://smtp2go.com to send emails from the ESP's, look through here....
https://github.com/EnvironmentMonitor/E ... -Gmail.ino

Re: How to send a e-mail (ESP32-Arduino)

Posted: Mon Aug 21, 2017 2:25 pm
by jcrfonera
Hello all

A very nice solution exists:
Use this library:
[url][/https://github.com/gpepe/esp8266-sendemail]
And this program:

Code: Select all

[/
#include <WiFi.h>
#include <sendemail.h>
/*
*     to enable/disable  debug on Serial: Please  see sendemail.h
*
*/
const char* SSID = "------"; 
const char* PASS = "----------"; 

void setup()
{
  Serial.begin(115200);
  delay(10);
  Serial.println("");
  Serial.print("Connecting To ");
  WiFi.begin(SSID, PASS);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi Connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  // create object
  SendEmail e("smtp.gmail.com", 465, "email_account@gmail.com", "password", 5000, true); 
  // Send Email
  e.send("<email_account@gmail.com>", "<email_to_send@gmail.com>", "test", "bonjour XXXX"); 
}
void loop()
{ }
]

It works very well !!   ;)