EMailSender
Arduino, esp32, Esp8266 EMailSender with Arduino IDE, simple library to send email via smtp with attachments.
Install / Use
/learn @xreef/EMailSenderREADME
EMailSender Library v4.1.3

A comprehensive Arduino library for sending emails via SMTP with full support for attachments, multiple recipients, and secure connections (SSL/TLS and STARTTLS).
Author: Renzo Mischianti
Website: www.mischianti.org
GitHub: @xreef
📚 Documentation & Tutorials
Complete tutorials and articles available on mischianti.org:
General Documentation
- 🌐 EMailSender Library Home - Main library page with all articles
- 📖 🇺🇸 Library Forum & Support - Community support and discussions
- 📖 🇮🇹 Forum e supporto alla libreria - Community support and discussions
Platform-Specific Guides
ESP32 & ESP8266 Tutorials
- 📧 How to Send Emails with Attachments on ESP32/ESP8266 (EMailSender v4.0.0 & STARTTLS) - Covers the latest v4.0.0 library update. Focuses on STARTTLS (port 587) support, which is required for modern Gmail. Includes wiring for SD cards.
- 📧 ESP32: Send email with attachments (Gmail, Yahoo, Outlook) - Complete guide for ESP32
- 🔐 ESP32: Secure email with SSL/TLS and attachments - SSL/TLS configuration
- 📎 ESP32: Manage SPIFFS and send attachments - SPIFFS file attachments
- 💾 ESP32: LittleFS filesystem and email attachments - LittleFS integration
- 📁 ESP32: FFAT filesystem and large file attachments - FFAT for large files
- 📧 ESP8266: Send email with attachments - Complete guide for ESP8266
- 📎 ESP8266: Manage SPIFFS and send attachments - SPIFFS integration
- 💾 ESP8266: LittleFS filesystem and email attachments - LittleFS support
Arduino Tutorials
- 📧 Arduino UNO/Mega and Ethernet: Sending Emails with Attachments (EMailSender v4.0.0 Library) - Specifically for boards with limited SRAM (UNO/Mega). Uses Ethernet shields (W5100/W5500). Addresses memory optimization techniques for v4.0.0.
- 📧 Arduino: Send email with attachments (Ethernet shield) - Arduino with ENC28J60
- 🔐 Arduino: Secure SSL/TLS email with Ethernet - SSL configuration for Arduino
- 📎 Arduino: SD card attachments with Ethernet - SD card integration
- 📡 Arduino: WiFiNINA shield and email sending - WiFiNINA shield
STM32 Tutorials
- 📧 STM32: Send email with W5500 Ethernet - STM32 with W5500
- 🔐 STM32: Secure SSL/TLS email with W5500 - SSL/TLS for STM32
- 📎 STM32: SPI Flash attachments with email - SPI Flash integration
- 🌐 STM32: Send email with ENC28J60 - ENC28J60 Ethernet
Raspberry Pi Pico (RP2040) Tutorials
- 📧 Raspberry Pi Pico W: Send email with attachments - Pico W WiFi
- 💾 Raspberry Pi Pico: LittleFS and email attachments - LittleFS integration
Advanced Topics
- 🔐 STARTTLS vs SSL/TLS: Understanding secure email - NEW! Security protocols explained
- 📮 Gmail App Passwords: Setup guide - Configure Gmail for Arduino
- 🛠️ Troubleshooting email sending issues - Common problems and solutions
📋 Table of Contents
- Features
- Supported Platforms
- Supported Network Interfaces
- Supported Storage Systems
- Installation
- Basic Usage
- Changelog v4.0.0
✨ Features
Core Features
- ✅ Send emails via SMTP with authentication
- ✅ Multiple recipients (To, Cc, Bcc)
- ✅ HTML and plain text email formats
- ✅ File attachments from various storage systems
- ✅ Base64 encoding for attachments
- ✅ Custom sender name and email address
- ✅ Subject and message body customization
Security Features (NEW in v4.0.0)
- ✅ STARTTLS support (Port 587) - NEW!
- ✅ Implicit SSL/TLS (Port 465)
- ✅ Multiple authentication methods:
- AUTH LOGIN (default)
- AUTH PLAIN (SASL)
- CRAM-MD5 (ESP32 only)
- ✅ Internal SSLClient for STARTTLS on ESP32/ESP8266
- ✅ OpenSLab SSLClient (BearSSL) for Ethernet shields
Network Support
- Multiple network interfaces (WiFi, Ethernet, WiFiNINA)
- Automatic IP resolution
- Connection retry logic
- Flexible client configuration
🎯 Supported Platforms
| Platform | WiFi | Ethernet | SSL/TLS | STARTTLS | |----------|------|----------|---------|----------| | ESP32 | ✅ | ✅ | ✅ | ✅ | | ESP8266 | ✅ | ✅ | ✅ | ✅ | | Arduino Mega/Uno | ❌ | ✅ | ❌ | ❌ | | Arduino SAMD | ✅ | ✅ | ✅ | ✅ | | STM32 | ❌ | ✅ | ✅ | ✅ | | Raspberry Pi Pico (RP2040) | ✅ | ✅ | ✅ | ✅ |
⚠️ IMPORTANTE - Arduino Mega/Uno e SSL/TLS:
Arduino Mega and Uno DO NOT support SSL/TLS due to severe RAM limitations:
- Arduino Mega has only 8KB of RAM
- Arduino Uno has only 2KB of RAM
- BearSSL for SSL/TLS requires at least 24KB of RAM for encryption buffers
Alternative solutions for Arduino Mega/Uno:
- ✅ Use non-secure SMTP (port 25) - Works but not recommended
- ✅ Use a local SMTP relay - Configure a local server that handles SSL
- ✅ Switch to ESP32/ESP8266 - They have more RAM and native SSL/TLS support
- ✅ Use Arduino SAMD (MKR WiFi 1010) - Has 32KB RAM and supports SSL/TLS
Arduino Mega/Uno examples in this library use only non-secure SMTP!
🌐 Supported Network Interfaces
- WiFi (ESP32/ESP8266) - WiFiClient / WiFiClientSecure
- WiFi (SAMD/MBED) - WiFiNINA library
- Ethernet W5100/W5200/W5500 - Standard Ethernet library
- Ethernet ENC28J60 - UIPEthernet library
- Ethernet with SSL - SSLClient wrapper for secure connections
💾 Supported Storage Systems
Internal Storage (Microcontroller Flash)
- SPIFFS (ESP32, ESP8266)
- LittleFS (ESP32, ESP8266, RP2040)
- FFAT (ESP32)
- SPIFM (SPI Flash with Adafruit_SPIFlash)
- Generic stream and string attachments option
External Storage (SD/microSD Cards)
- SD (Standard SD library)
- SdFat (Version 1.x for RP2040/ESP8266)
- SdFat2 (Version 2.x for modern platforms)
📦 Installation
Arduino IDE
- Open Arduino IDE
- Go to Sketch > Include Library > Manage Libraries
- Search for "EMailSender"
- Click Install
PlatformIO
Add to your platformio.ini:
lib_deps =
xreef/EMailSender@^4.1.3
Manual Installation
- Download the library from GitHub
- Extract to Arduino libraries folder
- Restart Arduino IDE
🚀 Basic Usage
Simple Email (ESP32 with Gmail)
#include <WiFi.h>
#include <EMailSender.h>
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
// Gmail SMTP configuration
EMailSender emailSend("your.email@gmail.com",
"your_app_password",
"your.email@gmail.com",
"Your Name",
"smtp.gmail.com",
587); // Port 587 for STARTTLS
void
