Extra 5% OFF Use Code: OL05
Free Shipping over ₹999

Esp32 Email

ESP32 Send Emails using an SMTP Server: HTML, Text, and Attachments (Arduino IDE)

Discover how to send emails using the ESP32 through an SMTP server. We’ll guide you through sending basic emails containing HTML or plain text, as well as attaching files such as images and .txt files. All programming will be done using the Arduino IDE.

Introduction of SMTP

SMTP, or Simple Mail Transfer Protocol, is the backbone of email transmission on the internet. When you want to send emails using an ESP32, you’ll need to link it up with an SMTP Server, which acts as the mail carrier, ensuring your messages get where they need to go.

ESP mail client Liabray

To handle email tasks on the ESP32, we’ll rely on the ESP-Mail-Client library. This library simplifies the process of sending and receiving emails, whether they include attachments or not, by leveraging SMTP and IMAP servers.

Throughout this tutorial, we’ll focus on utilizing SMTP to send emails, demonstrating both with and without attachments. As a practical example, we’ll send an image (.png) and a text (.txt) file.

Installing the ESP-Mail-Client Library

Before diving into this tutorial, make sure to install the ESP-Mail-Client library.

Simply navigate to Sketch > Include Library > Manage Libraries within the Arduino IDE. Then, search for “ESP Mail Client” and proceed to install the library developed by Mobizt.

New Account (Sender Email)

For sending emails via ESP32, it’s advisable to set up a new email account specifically for this purpose. Avoid using your main personal email to prevent any potential issues. If there are errors in your code or if too many requests are made, it could result in your account being banned or temporarily disabled.

SMTP, Gmail Server setting:
If you’re utilizing a Gmail account, here are the SMTP Server settings you’ll need:

  • SMTP Server: smtp.gmail.com
  • SMTP Username: Your complete Gmail address
  • SMTP Password: Your Gmail password
  • SMTP Port (TLS): 587
  • SMTP Port (SSL): 465
  • SMTP TLS/SSL Required: Yes
Outlook SMTP Server Settings

For Outlook accounts, here are the SMTP Server settings you’ll need:

  • SMTP Server: smtp.office365.com
  • SMTP Username: Your complete Outlook email address
  • SMTP Password: Your Outlook password
  • SMTP Port: 587
  • SMTP TLS/SSL Required: Yes

Live or Hotmail SMTP Server Settings

For Live or Hotmail accounts, here are the SMTP Server settings you’ll need:

  • SMTP Server: smtp.live.com
  • SMTP Username: Your complete Live/Hotmail email address
  • SMTP Password: Your Windows Live Hotmail password
  • SMTP Port: 587
  • SMTP TLS/SSL Required: Yes

    Leave a Reply

    Your email address will not be published.

    Need Help?