{"id":18837049,"url":"https://github.com/xreef/emailsender","last_synced_at":"2025-10-15T10:29:51.640Z","repository":{"id":41133712,"uuid":"154733394","full_name":"xreef/EMailSender","owner":"xreef","description":"Arduino, esp32, Esp8266 EMailSender with Arduino IDE, simple library to send email via smtp with attachments.","archived":false,"fork":false,"pushed_at":"2025-10-05T09:04:24.000Z","size":1398,"stargazers_count":75,"open_issues_count":2,"forks_count":31,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-05T11:26:14.010Z","etag":null,"topics":["arduino","arduino-library","email-sender","esp32","esp8266","ethernet","gmail-smtp","pico-w","raspberry","rp2040","smtp","wifi","wifinina"],"latest_commit_sha":null,"homepage":"https://www.mischianti.org/category/my-libraries/emailsender-send-email-with-attachments/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xreef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-25T20:28:57.000Z","updated_at":"2025-06-21T01:08:17.000Z","dependencies_parsed_at":"2023-10-17T11:52:15.191Z","dependency_job_id":"e65717c3-d4b8-446d-aacd-42820d2abd47","html_url":"https://github.com/xreef/EMailSender","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/xreef/EMailSender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FEMailSender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FEMailSender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FEMailSender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FEMailSender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xreef","download_url":"https://codeload.github.com/xreef/EMailSender/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FEMailSender/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279073238,"owners_count":26097358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","email-sender","esp32","esp8266","ethernet","gmail-smtp","pico-w","raspberry","rp2040","smtp","wifi","wifinina"],"created_at":"2024-11-08T02:33:34.184Z","updated_at":"2025-10-15T10:29:51.634Z","avatar_url":"https://github.com/xreef.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EMailSender Library v4.0.1\n\n![EMailSender Logo](https://raw.githubusercontent.com/xreef/EMailSender/master/resources/EMailSenderLogo.jpg)\n\n[![arduino-library-badge](https://www.ardu-badge.com/badge/EMailSender.svg?)](https://www.ardu-badge.com/EMailSender)\n\nA comprehensive Arduino library for sending emails via SMTP with full support for attachments, multiple recipients, and secure connections (SSL/TLS and STARTTLS).\n\n**Author:** Renzo Mischianti  \n**Website:** [www.mischianti.org](https://www.mischianti.org)  \n**GitHub:** [@xreef](https://github.com/xreef/EMailSender)\n\n---\n\n## 📚 Documentation \u0026 Tutorials\n\nComplete tutorials and articles available on [mischianti.org](https://www.mischianti.org):\n\n### General Documentation\n- 🌐 **[EMailSender Library Home](https://www.mischianti.org/category/my-libraries/emailsender-send-email-with-attachments/)** - Main library page with all articles\n- 📖 **[Library Forum \u0026 Support](https://www.mischianti.org/forums/)** - Community support and discussions\n\n### Platform-Specific Guides\n\n#### ESP32 Tutorials\n- 📧 **[ESP32: Send email with attachments (Gmail, Yahoo, Outlook)](https://www.mischianti.org/2020/05/16/how-to-send-emails-with-attachments-with-esp32-gmail-and-smtp-server/)** - Complete guide for ESP32\n- 🔐 **[ESP32: Secure email with SSL/TLS and attachments](https://www.mischianti.org/2020/05/20/esp32-send-secure-ssl-tls-emails-with-gmail-and-attachments/)** - SSL/TLS configuration\n- 📎 **[ESP32: Manage SPIFFS and send attachments](https://www.mischianti.org/2020/05/23/esp32-manage-filesystem-spiffs-and-send-email-attachments/)** - SPIFFS file attachments\n- 💾 **[ESP32: LittleFS filesystem and email attachments](https://www.mischianti.org/2021/04/12/esp32-integrated-littlefs-filesystem-email-attachments/)** - LittleFS integration\n- 📁 **[ESP32: FFAT filesystem and large file attachments](https://www.mischianti.org/2021/04/19/esp32-integrated-ffat-fat-filesystem-email-attachments/)** - FFAT for large files\n\n#### ESP8266 Tutorials\n- 📧 **[ESP8266: Send email with attachments](https://www.mischianti.org/2020/05/30/how-to-send-emails-with-attachments-with-esp8266-gmail-and-smtp/)** - Complete guide for ESP8266\n- 📎 **[ESP8266: Manage SPIFFS and send attachments](https://www.mischianti.org/2020/06/03/esp8266-manage-filesystem-spiffs-and-send-email-attachments/)** - SPIFFS integration\n- 💾 **[ESP8266: LittleFS filesystem and email attachments](https://www.mischianti.org/2021/04/26/esp8266-integrated-littlefs-filesystem-email-attachments/)** - LittleFS support\n\n#### Arduino Tutorials\n- 📧 **[Arduino: Send email with attachments (Ethernet shield)](https://www.mischianti.org/2020/06/09/how-to-send-emails-with-attachments-with-arduino-and-enc28j60/)** - Arduino with ENC28J60\n- 🔐 **[Arduino: Secure SSL/TLS email with Ethernet](https://www.mischianti.org/2020/06/13/how-to-send-secure-ssl-tls-emails-with-arduino-and-enc28j60/)** - SSL configuration for Arduino\n- 📎 **[Arduino: SD card attachments with Ethernet](https://www.mischianti.org/2020/06/16/arduino-ethernet-enc28j60-send-email-with-sd-attachments/)** - SD card integration\n- 📡 **[Arduino: WiFiNINA shield and email sending](https://www.mischianti.org/2020/07/07/how-to-send-emails-with-attachments-with-arduino-mkr-wifi1010-and-wifinina/)** - WiFiNINA shield\n\n#### STM32 Tutorials\n- 📧 **[STM32: Send email with W5500 Ethernet](https://www.mischianti.org/2021/02/22/how-to-send-emails-with-attachments-with-stm32-w5500-ethernet/)** - STM32 with W5500\n- 🔐 **[STM32: Secure SSL/TLS email with W5500](https://www.mischianti.org/2021/02/25/stm32-send-secure-ssl-tls-emails-with-w5500/)** - SSL/TLS for STM32\n- 📎 **[STM32: SPI Flash attachments with email](https://www.mischianti.org/2021/03/01/stm32-spi-flash-filesystem-and-email-attachments/)** - SPI Flash integration\n- 🌐 **[STM32: Send email with ENC28J60](https://www.mischianti.org/2021/03/08/how-to-send-emails-with-attachments-with-stm32-enc28j60/)** - ENC28J60 Ethernet\n\n#### Raspberry Pi Pico (RP2040) Tutorials\n- 📧 **[Raspberry Pi Pico W: Send email with attachments](https://www.mischianti.org/2022/07/11/raspberry-pi-pico-rp2040-send-email-with-attachments/)** - Pico W WiFi\n- 💾 **[Raspberry Pi Pico: LittleFS and email attachments](https://www.mischianti.org/2022/07/18/raspberry-pi-pico-rp2040-littlefs-filesystem-email-attachments/)** - LittleFS integration\n\n### Advanced Topics\n- 🔐 **[STARTTLS vs SSL/TLS: Understanding secure email](https://www.mischianti.org/2025/01/04/starttls-vs-ssl-tls-secure-email-arduino/)** - NEW! Security protocols explained\n- 📮 **[Gmail App Passwords: Setup guide](https://www.mischianti.org/2020/05/16/gmail-app-passwords-configuration/)** - Configure Gmail for Arduino\n- 🛠️ **[Troubleshooting email sending issues](https://www.mischianti.org/2020/06/20/troubleshooting-email-sending-arduino-esp32-esp8266/)** - Common problems and solutions\n\n---\n\n## 📋 Table of Contents\n- [Features](#-features)\n- [Supported Platforms](#-supported-platforms)\n- [Supported Network Interfaces](#-supported-network-interfaces)\n- [Supported Storage Systems](#-supported-storage-systems)\n- [Installation](#-installation)\n- [Basic Usage](#-basic-usage)\n- [Changelog v4.0.0](#-changelog-v400)\n\n## ✨ Features\n\n### Core Features\n- ✅ **Send emails via SMTP** with authentication\n- ✅ **Multiple recipients** (To, Cc, Bcc)\n- ✅ **HTML and plain text** email formats\n- ✅ **File attachments** from various storage systems\n- ✅ **Base64 encoding** for attachments\n- ✅ **Custom sender name** and email address\n- ✅ **Subject and message body** customization\n\n### Security Features (NEW in v4.0.0)\n- ✅ **STARTTLS support** (Port 587) - NEW!\n- ✅ **Implicit SSL/TLS** (Port 465)\n- ✅ **Multiple authentication methods**:\n  - AUTH LOGIN (default)\n  - AUTH PLAIN (SASL)\n  - CRAM-MD5 (ESP32 only)\n- ✅ **Internal SSLClient** for STARTTLS on ESP32/ESP8266\n- ✅ **OpenSLab SSLClient** (BearSSL) for Ethernet shields\n\n### Network Support\n- Multiple network interfaces (WiFi, Ethernet, WiFiNINA)\n- Automatic IP resolution\n- Connection retry logic\n- Flexible client configuration\n\n## 🎯 Supported Platforms\n\n| Platform | WiFi | Ethernet | SSL/TLS | STARTTLS |\n|----------|------|----------|---------|----------|\n| **ESP32** | ✅ | ✅ | ✅ | ✅ |\n| **ESP8266** | ✅ | ✅ | ✅ | ✅ |\n| **Arduino Mega/Uno** | ❌ | ✅ | ❌ | ❌ |\n| **Arduino SAMD** | ✅ | ✅ | ✅ | ✅ |\n| **STM32** | ❌ | ✅ | ✅ | ✅ |\n| **Raspberry Pi Pico (RP2040)** | ✅ | ✅ | ✅ | ✅ |\n\n\u003e **⚠️ IMPORTANTE - Arduino Mega/Uno e SSL/TLS:**\n\u003e \n\u003e **Arduino Mega and Uno DO NOT support SSL/TLS** due to severe RAM limitations:\n\u003e - Arduino Mega has only **8KB of RAM**\n\u003e - Arduino Uno has only **2KB of RAM**\n\u003e - BearSSL for SSL/TLS requires at least **24KB of RAM** for encryption buffers\n\u003e \n\u003e **Alternative solutions for Arduino Mega/Uno:**\n\u003e 1. ✅ **Use non-secure SMTP (port 25)** - Works but not recommended\n\u003e 2. ✅ **Use a local SMTP relay** - Configure a local server that handles SSL\n\u003e 3. ✅ **Switch to ESP32/ESP8266** - They have more RAM and native SSL/TLS support\n\u003e 4. ✅ **Use Arduino SAMD (MKR WiFi 1010)** - Has 32KB RAM and supports SSL/TLS\n\u003e \n\u003e **Arduino Mega/Uno examples in this library use only non-secure SMTP!**\n\n## 🌐 Supported Network Interfaces\n\n- **WiFi (ESP32/ESP8266)** - WiFiClient / WiFiClientSecure\n- **WiFi (SAMD/MBED)** - WiFiNINA library\n- **Ethernet W5100/W5200/W5500** - Standard Ethernet library\n- **Ethernet ENC28J60** - UIPEthernet library\n- **Ethernet with SSL** - SSLClient wrapper for secure connections\n\n## 💾 Supported Storage Systems\n\n### Internal Storage (Microcontroller Flash)\n- **SPIFFS** (ESP32, ESP8266)\n- **LittleFS** (ESP32, ESP8266, RP2040)\n- **FFAT** (ESP32)\n- **SPIFM** (SPI Flash with Adafruit_SPIFlash)\n\n### External Storage (SD/microSD Cards)\n- **SD** (Standard SD library)\n- **SdFat** (Version 1.x for RP2040/ESP8266)\n- **SdFat2** (Version 2.x for modern platforms)\n\n## 📦 Installation\n\n### Arduino IDE\n1. Open Arduino IDE\n2. Go to **Sketch \u003e Include Library \u003e Manage Libraries**\n3. Search for \"**EMailSender**\"\n4. Click **Install**\n\n### PlatformIO\nAdd to your `platformio.ini`:\n```ini\nlib_deps = \n    xreef/EMailSender@^4.0.0\n```\n\n### Manual Installation\n1. Download the library from [GitHub](https://github.com/xreef/EMailSender)\n2. Extract to Arduino libraries folder\n3. Restart Arduino IDE\n\n## 🚀 Basic Usage\n\n### Simple Email (ESP32 with Gmail)\n\n```cpp\n#include \u003cWiFi.h\u003e\n#include \u003cEMailSender.h\u003e\n\nconst char* ssid = \"YOUR_SSID\";\nconst char* password = \"YOUR_PASSWORD\";\n\n// Gmail SMTP configuration\nEMailSender emailSend(\"your.email@gmail.com\", \n                      \"your_app_password\",\n                      \"your.email@gmail.com\", \n                      \"Your Name\",\n                      \"smtp.gmail.com\", \n                      587);  // Port 587 for STARTTLS\n\nvoid setup() {\n  Serial.begin(115200);\n  \n  // Connect to WiFi\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(\".\");\n  }\n  Serial.println(\"\\nWiFi Connected!\");\n  \n  // Prepare email message\n  EMailSender::EMailMessage message;\n  message.subject = \"Test Email\";\n  message.message = \"Hello from ESP32!\";\n  \n  // Send email\n  EMailSender::Response resp = emailSend.send(\"recipient@example.com\", message);\n  \n  Serial.println(\"Sending status: \");\n  Serial.println(resp.code);\n  Serial.println(resp.desc);\n  Serial.println(resp.status);\n}\n\nvoid loop() {\n  // Nothing here\n}\n```\n\n### HTML Email with Multiple Recipients\n\n```cpp\nEMailSender::EMailMessage message;\nmessage.subject = \"HTML Email Test\";\nmessage.message = \"\u003ch1\u003eHello!\u003c/h1\u003e\u003cp\u003eThis is an \u003cb\u003eHTML\u003c/b\u003e email.\u003c/p\u003e\";\nmessage.mime = MIME_TEXT_HTML;  // Set MIME type to HTML\n\n// Multiple recipients\nconst char* recipients[] = {\n  \"recipient1@example.com\",\n  \"recipient2@example.com\",\n  \"recipient3@example.com\"\n};\n\nEMailSender::Response resp = emailSend.send(recipients, 3, message);\n```\n\n### Email with CC and BCC\n\n```cpp\n// Array with To, Cc, and Bcc addresses\nconst char* allRecipients[] = {\n  \"to@example.com\",      // To (1)\n  \"cc@example.com\",      // Cc (1)\n  \"bcc@example.com\"      // Bcc (1)\n};\n\n// send(recipients, numTo, numCc, numBcc, message)\nEMailSender::Response resp = emailSend.send(allRecipients, 1, 1, 1, message);\n```\n\n### Debug Mode\n\nEnable debugging by uncommenting in `EMailSenderKey.h`:\n\n```cpp\n#define EMAIL_SENDER_DEBUG\n#define DEBUG_PRINTER Serial\n```\n\nThis will print detailed SMTP communication to Serial Monitor.\n\n### Memory Issues\n\nFor boards with limited RAM (like Arduino Uno):\n- Disable attachments if not needed\n- Use smaller email messages\n- Consider using Arduino Mega or ESP32\n\n### Gmail Specific Issues\n\n**\"Username and Password not accepted\"**\n1. Enable 2-Factor Authentication\n2. Generate App Password at https://myaccount.google.com/apppasswords\n3. Use the 16-character app password (no spaces)\n\n**\"Less secure app access\"**\n- Google removed \"less secure apps\" option\n- You MUST use App Passwords now\n- Regular account password will not work\n\n## Change log v4.x\n- 09/10/2025: v4.0.1 Fix path sslclient and code completition of Platformio \n\n\n## 📝 Changelog v4.0.0 - 08/10/2025\n\n### New Features\n- ✨ **STARTTLS support (Port 587)** - Full implementation for secure email on port 587\n- ✨ **Internal SSLClient integration** - Built-in SSL/TLS support for ESP32/ESP8266\n- ✨ **Enhanced authentication** - Better support for various SMTP auth methods\n- ✨ **Improved error handling** - More detailed error messages and responses\n\n### Improvements\n- 🔧 Unified client handling for better compatibility\n- 🔧 Better SSL/TLS handshake management\n- 🔧 Improved EHLO/HELO command handling with multi-line response support\n- 🔧 Enhanced connection retry logic\n- 🔧 Better memory management for large attachments\n\n### Bug Fixes\n- 🐛 Fixed SSLClient initialization on ESP32\n- 🐛 Fixed STARTTLS upgrade sequence\n- 🐛 Corrected client scope issues\n- 🐛 Fixed BearSSL integration for Ethernet shields\n\n### Breaking Changes\n- ⚠️ Minimum Arduino IDE version: 1.8.x\n- ⚠️ ESP32 core minimum version: 2.0.x (for WiFiClientSecure improvements)\n- ⚠️ Some internal API changes (user-facing API remains compatible)\n\n### Migration from v3.x\nMost code will work without changes. If using custom client configuration:\n- Check `EMailSenderKey.h` for new defines\n- Update authentication methods if using advanced features\n- Test STARTTLS connections (port 587) for better security\n\n## Change log v3.x\n- 14/03/2024: v3.0.14 Support Arduino GIGA WiFi\n- 31/10/2023: v3.0.13 Fix wrong implementation of FORCE_DISABLE_SSL\n- 17/10/2023: v3.0.12 Fix warnigs of variable not used #43 thanks to @Patriboom @Andy2015\n- 16/02/2023: v3.0.11 Add support for Ethernet_Generic\n- 20/01/2023: v3.0.10 Add the management of ESP8266SdFat library on Raspberry Pi Pico [#forum](https://www.mischianti.org/forums/topic/raspberry-pico-w-emailsender)\n- 17/01/2023: v3.0.10 Add the mamagement of auto check of response number #36 thanks to @HACKER-3000 @H3\n- 13/01/2023: v3.0.9 Fix external storage error 404 ([#forum](https://www.mischianti.org/forums/topic/email-with-sd-files/)\n- 05/01/2023: v3.0.8 Fix distribution list examples\n- 22/09/2022: v3.0.7 Add Raspberry Pi Pico W and rp2040 boards\n- 20/09/2022: v3.0.7 Add STM32 management for https://github.com/rogerclarkmelbourne/Arduino_STM32 library.\n- 16/08/2022: v3.0.6 Add FORCE_DISABLE_SSL to disable SSL if present\n- 19/07/2022: v3.0.5 Additional fix on additional response management ([#26](https://github.com/xreef/EMailSender/issues/26))\n- 12/07/2022: v3.0.4 Fixed attachment issue on SPIFFS and LittleFS\n- 06/07/2022: v3.0.3 Manage multiple response message after connect and HELO ([#26](https://github.com/xreef/EMailSender/issues/26))\n- 03/06/2022: v3.0.2 Add possibility to set additionalResponseLineOnConnection with void setAdditionalResponseLineOnConnection(uint8_t numLines = 0), needed if on connection you receive 220 response as error, and add Ethernet2.\n- 20/05/2022: v3.0.1 Put inside scope the client declaration (if you don't use SSLClient) for backward compatibility\n- 18/05/2022: v3.0.0 Add STM32 support. Add SSLClient integration to allow send Email with SSL encryption (like Gmail) with ethernet (tested with STM32, ESP32, w5500, and enc28j60), minor fix\n- 12/04/2021: v2.4.3 Fix multiple email send\n- 12/04/2021: v2.4.1 Add support for LITTLEFS and Ffat on esp32 and fix certificate verification from esp32 core 1.0.5\n- 18/03/2021: v2.3.0 Add support for LittleFS on esp8266\n- 02/01/2021: v2.2.0 New support for SAMD devices via WiFiNINA (Arduino MKR WiFi 1010, Arduino Vidor 4000 and Arduino UNO WiFi Rev.2 ecc.).\n- 01/01/2021: v2.1.5 Add possibility to use EHLO instead of HELO, and SASL login.\n- 27/11/2020: v2.1.4 Add more constructor to allow more structure for distribution list (now const char*, char* and String array are supported)\n\n## 📄 License\n\nMIT License - See LICENSE file for details\n\nCopyright (c) 2017-2025 Renzo Mischianti\n\n## 🤝 Contributing\n\nContributions are welcome! Please:\n1. Fork the repository\n2. Create a feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n\n## 📞 Support\n\n- **Website**: https://www.mischianti.org\n- **GitHub Issues**: https://github.com/xreef/EMailSender/issues\n- **Forum**: https://www.mischianti.org/forums/\n\n## 👤 Author\n\n**Renzo Mischianti**\n- Website: https://www.mischianti.org\n- Email: renzo.mischianti@gmail.com\n- GitHub: [@xreef](https://github.com/xreef)\n\n## ⭐ Show Your Support\n\nIf this library helped your project, please ⭐ star it on GitHub!\n\n---\n\nMade with ❤️ by Renzo Mischianti\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxreef%2Femailsender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxreef%2Femailsender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxreef%2Femailsender/lists"}