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

User avatar
Pyshco
Posts: 28
Joined: Wed Jul 19, 2017 2:36 pm

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

Postby Pyshco » Tue Aug 01, 2017 3:55 pm

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?

tele_player
Posts: 90
Joined: Sun Jul 02, 2017 3:38 am

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

Postby tele_player » Tue Aug 01, 2017 4:19 pm

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.

gdsports
Posts: 15
Joined: Wed Aug 02, 2017 12:17 am

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

Postby gdsports » Wed Aug 02, 2017 12:24 am

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.

Gengus_Kahn
Posts: 3
Joined: Sun Jul 30, 2017 7:17 am

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

Postby Gengus_Kahn » Wed Aug 02, 2017 9:28 am

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

jcrfonera
Posts: 3
Joined: Mon Aug 21, 2017 10:01 am

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

Postby jcrfonera » Mon Aug 21, 2017 2:25 pm

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 !!   ;)

Who is online

Users browsing this forum: No registered users and 70 guests