5.1 ESP32 Email

less than 1 minute read

SMTP : Simple Mail Transfer Protocol
ESP32 can send google Email.

Tutorial link

Change configure your account.
Google Secure Access

NOT SMTP -> PHP SCRIPT

configure

Network

#define WIFI_SSID "Wlan0 SSID"
#define WIFI_PASSWORD "Wlan0 Password"

SMTP Server Type

#define SMTP_HOST "smtp.gmail.com"
#define SMTP_PORT 465


  1. smtp.gmail.com // Gmail
  2. smtp.office365.com // Outlook
  3. smtp.live.com // HotMail or Live

Sender email

#define AUTHOR_EMAIL "Sender email@gmail.com"
#define AUTHOR_PASSWORD "Sender password"

Recipient email

#define RECIPIENT_EMAIL "scooldong@gmail.com"

Send message

  message.sender.name = "보낸 사람";
  message.sender.email = AUTHOR_EMAIL;
  message.subject = "제목";
  message.addRecipient("받는 사람", RECIPIENT_EMAIL);

  /*Send HTML message*/
  String htmlMsg = "<div style=\"color:#2f4468;\"><h1>내용 큰 글씨</h1><p>- 내용 작은 글씨</p></div>";
  message.html.content = htmlMsg.c_str();
  message.html.content = htmlMsg.c_str();
  message.text.charSet = "us-ascii";
  message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;


Send Picture and Text file

Downlaod FileSystem

ESP32FileSystem_Tutorials Link

Download ESP32FileSystem LINK

Attach file

message.addAttachment(att);     // file 1
message.resetAttachItem(att);   // reset file 1
message.addAttachment(att);     // file 2


Go to top

Leave a comment