You can send email from an ESP8266 using an Arduino sketch and an authenticated SMTP server. Install the ESP8266 Arduino core and the ESP-Mail-Client library, connect the board to Wi-Fi, configure your mail provider’s host, port, authentication and TLS mode, then build and send an SMTP message. For Gmail, use a provider-approved method such as an app password or access token—not your ordinary account password.
What you need
- An ESP8266 development board, such as a NodeMCU-style board.
- Arduino IDE with the official ESP8266 Arduino core installed.
- The ESP-Mail-Client library.
- A mailbox or SMTP relay that permits authenticated SMTP and provides its server name, port, login method and TLS requirements.
- Wi-Fi credentials and a provider-approved SMTP credential.
The ESP8266 Arduino core lets compatible boards run Arduino sketches and use Wi-Fi networking. Follow the official ESP8266 Arduino core installation instructions to add its Boards Manager package and select the board that matches your hardware. Mobizt’s ESP-Mail-Client project provides SMTP sending, message construction, TLS/SSL and STARTTLS support, authentication options, callbacks, and status and error APIs.
Configure Arduino IDE and install the library
- In Arduino IDE, install the ESP8266 board package using the package index URL and workflow documented by the official ESP8266 core project.
- Choose your specific ESP8266 board in the IDE’s board selector. A mismatched board selection can cause build or upload problems.
- Install ESP-Mail-Client using the library installation method documented by the library project.
- Include
ESP8266WiFi.handESP_Mail_Client.hin your sketch.
Get the SMTP host, port, and authentication method
SMTP settings depend on your email provider or relay. Obtain the exact server name, port, login method and secure mode from that provider; do not assume one provider’s settings apply to another. ESP-Mail-Client examples show Gmail configured on port 587 for STARTTLS and port 465 for SSL. These are examples, not a guarantee that every account or relay uses the same configuration.
Use the secure mode that matches the chosen port and provider configuration. Do not configure direct SSL on a connection intended for STARTTLS. For Gmail, the PlatformIO registry notes Google’s May 30, 2022 change requiring an app password for this class of SMTP access; the ordinary account password is not sufficient. Use an app password or an access-token flow if permitted for your account. The PlatformIO registry entry and the library documentation describe the supported login approaches.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Not only it is easy to program for this controller by using the CP2102-USB interface,but also unnecessary to press the flash and reset buttons before each flash operation.
- NodeMcu is an open source Lua based firmware for the ESP8266, ultra low cost wireless modules, development boards for rapid prototyping, integrated with ESP8266 chips.
- The ESP8266 has powerful on-board processing and storage capabilities, and can be integrated with sensors and other application-specific devices through its GPIOs.
- It is compatible with Arduino IDE,works great with the latest Mongoose IoT/Micropython.
- Modern Internet development tools can use the built-in API to instantly put your idea on the fast track.
Build the email sketch
This sketch shows the core structure. Replace the example values with your Wi-Fi and SMTP settings, then complete the indicated setup steps using the example matching the version of ESP-Mail-Client installed in your IDE:
#include <ESP8266WiFi.h>
#include <ESP_Mail_Client.h>
// Use private values; do not publish real credentials.
const char* WIFI_SSID = "your-ssid";
const char* WIFI_PASSWORD = "your-password";
const char* SMTP_HOST = "smtp.example.com";
const uint16_t SMTP_PORT = 587; // Example port; provider-specific
SMTPSession smtp;
SMTP_Message message;
void setup() {
// Connect to Wi-Fi.
// Configure the SMTP server, login and matching TLS mode.
// Set sender, subject, recipient and text or HTML content.
// Send with MailClient.sendMail(&smtp, &message).
// Check the result and diagnostics.
}
void loop() {}
The documented examples use session.server.host_name, session.server.port and login fields for the connection, then populate an SMTP_Message with sender, subject, recipient and body before calling MailClient.sendMail(&smtp, &message). Consult the installed library’s examples for the complete field assignments and secure-mode configuration because API details can vary by version. The library’s documentation and examples show the supported message formats and send routine.
Rank #2
- ESP8266 Breakout Board GPIO 1 into 2 Terminal Screw Board is Fully Compatible with ESP8266 ESP-12E
- GPIO 1 into 2: ESP8266 Breakout Board Can Expand 1 GPIO Pin to 2, Which is Convenient for Users to Reuse Pins for Large-Scale Smart Home Projects
- Double-Layer PCB: ESP8266 Breakout Board is a Double-Layer Board. One Pin is Wired On Both Sides. Therefore, the Circuit is Stable and Highly Reliable
- 2 Type Connections:ESP8266 Breakout Board Designed with Two Connection Methods: Pin Header Connector & Screw Terminal. Just Select Connection According to Your Need
- Convenient to USE: Compared with the Previous Version, Updated Version ESP8266 Breakout Board Has Been Soldered Completely. No Need to Solder Parts,Very Convenient to Use
Protect credentials and use TLS
- Do not commit Wi-Fi passwords, SMTP passwords or access tokens to a public repository. Keep secrets out of sketches you share.
- Use TLS or STARTTLS as required by the SMTP provider, and configure the library for that mode.
- If certificate validation depends on the device clock, make sure system time and certificate settings are valid; a TLS failure can prevent the connection even when the host and credentials are correct.
- Choose an authentication method the provider allows. For Gmail, use an app password or supported access-token flow rather than the standard account password.
Troubleshoot failed email delivery
Enable the library’s debug output and use its diagnostics to determine whether the failure occurs at Wi-Fi, TLS, authentication or SMTP response time. The relevant APIs include errorReason(), errorCode(), statusCode() and statusMessage(). Check the installed library documentation for the exact way to enable debug output and retrieve these values.
- Wi-Fi does not connect: Confirm the SSID and password and make sure the IDE’s selected board matches the hardware.
- SMTP server connection fails: Verify the host and port with the provider, and make sure the configured secure mode matches the port. In particular, do not use direct SSL settings for a STARTTLS connection.
- Authentication is rejected: Check whether the provider requires an app password, access token or another approved method, and confirm the account permits SMTP access.
- TLS negotiation fails: Check the secure-mode configuration and any system-time or certificate requirements used for validation.
- The server rejects the message: Read the SMTP status code and message, then verify the sender, recipient, subject and body fields.
ESP-Mail-Client describes support for ESP8266, ESP32 and other listed platforms, with SMTP and IMAP functionality. Its project metadata records a creation date of July 20, 2024; that date is not a performance or delivery-rate measurement. The project’s documentation and installed examples are the appropriate references for the API available in the version you use.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Best Value
- ESP8266 NodeMCU Lua ESP-12E CP2102 Development Board Module with USB C Type-C Interface, has a wider range of applications.
- Adopting the original brand new CP2102 chip with powerful functions, developing a complete set of tools for ESP8266.
- Built in Tensilica L106 ultra low power 32-bit micro MCU, with main frequency support of 80 MHz and 160 MHz
- Supports RTOS.
- Support many kinds of working modes like STAAP/STA+AP etc, support AT remote upgrade and cloud OTA , and upgrade for Smart Config function etc.
Rank #4
- NodeMCU GPIO expansion board
- NodeMCU can be connected through by Pin Header & Screw Terminal
- GPIO 1 INTO 2
Rank #3
- Built-in Micro-USB, with flash and reset switches, easy to program
- Arduino compatible, works great with the latest Arduino IDE/Mongoose IoT/Micropython
- Data download access to the website: http://www;nodemcu;com
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

