ReadyMail

ReadyMail Logo

βœ‰οΈ ReadyMail

Fast, lightweight, and asynchronous email client library for Arduino.
Supports both SMTP and IMAP with full RFC compliance. Designed for 32-bit MCUs including ESP8266, ESP32, Teensy, Arduino MKR, SAMD, STM32, RP2040, and more.

ReadyMail is designed to be hardware-agnostic. It supports all filesystem types (e.g. SPIFFS, LittleFS, SD) and all network client libraries, including GSMClient, WiFiClient, EthernetClient, and PPP. This ensures seamless integration across diverse hardware and connectivity environments.

License
Platform
RFC


πŸ“š Table of Contents


πŸš€ Features


πŸ“¦ Installation

πŸ”§ Arduino IDE

  1. Open Arduino IDE
  2. Go to Sketch > Include Library > Manage Libraries…
  3. Search for ReadyMail and click Install

Alternatively, install via ZIP file:

Download the latest release from:
https://github.com/mobizt/ReadyMail/releases

Then go to Sketch > Include Library > Add .ZIP Library…

βš™οΈ PlatformIO

Add this to your platformio.ini:

lib_deps =
  mobizt/ReadyMail@^0.4.1

βœ… Supports ESP32, STM32, RP2040, SAMD, Renesas and more β€” except AVR


πŸ“ Manual Installation

  1. Download the source from ReadyMail GitHub
  2. Extract to your Arduino libraries/ReadyMail folder

🧩 Supported Devices


πŸ“– RFC Compliance

ReadyMail adheres to key email protocol standards:

Protocol RFC Description
SMTP RFC 5321 Simple Mail Transfer Protocol
IMAP RFC 9051 Internet Message Access Protocol v4rev2
Message Format RFC 822 ARPA Internet Text Messages

πŸ› οΈ Getting Started

πŸ“€ Sending Email (SMTP)

#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>

#define ENABLE_SMTP
#define ENABLE_DEBUG
#include <ReadyMail.h>

WiFiClientSecure ssl_client;
SMTPClient smtp(ssl_client);

void setup() {
  Serial.begin(115200);
  WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
  while (WiFi.status() != WL_CONNECTED) delay(500);

  ssl_client.setInsecure();

  auto statusCallback = [](SMTPStatus status) {
    Serial.println(status.text);
  };

  smtp.connect("smtp.example.com", 465, statusCallback);

  if (smtp.isConnected()) {
    smtp.authenticate("user@example.com", "password", readymail_auth_password);

    SMTPMessage msg;
    msg.headers.add(rfc822_from, "ReadyMail <user@example.com>");
    msg.headers.add(rfc822_to, "Recipient <recipient@example.com>");
    msg.headers.add(rfc822_subject, "Hello from ReadyMail");
    msg.text.body("This is a plain text message.");
    msg.html.body("<html><body><h1>Hello!</h1></body></html>");

    configTime(0, 0, "pool.ntp.org");
    while (time(nullptr) < 100000) delay(100);
    msg.timestamp = time(nullptr);

    smtp.send(msg);
  }
}

void loop() {}

πŸ›‘οΈ SMTP Server Rejection and Spam Prevention

To ensure successful email delivery and avoid rejection or spam filtering by SMTP servers, follow these best practices:


πŸ“₯ Receiving Email (IMAP)

#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>

#define ENABLE_IMAP
#define ENABLE_DEBUG
#include <ReadyMail.h>

WiFiClientSecure ssl_client;
IMAPClient imap(ssl_client);

void setup() {
  Serial.begin(115200);
  WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
  while (WiFi.status() != WL_CONNECTED) delay(500);

  ssl_client.setInsecure();

  auto statusCallback = [](IMAPStatus status) {
    Serial.println(status.text);
  };

  auto dataCallback = [](IMAPCallbackData data) {
    if (data.event() == imap_data_event_fetch_envelope) {
      for (int i = 0; i < data.headerCount(); i++) {
        Serial.printf("%s: %s\n", data.getHeader(i).first.c_str(), data.getHeader(i).second.c_str());
      }
    }
  };

  imap.connect("imap.example.com", 993, statusCallback);

  if (imap.isConnected()) {
    imap.authenticate("user@example.com", "password", readymail_auth_password);
    imap.select("INBOX");
    imap.fetch(imap.getMailbox().msgCount, dataCallback);
  }
}

void loop() {}

πŸ”Œ Ports & Clients

Protocol Port Security Notes
SMTP 465 SSL Recommended
SMTP 587 STARTTLS Requires upgrade-capable client
IMAP 993 SSL Recommended
IMAP 143 STARTTLS Requires upgrade-capable client

See Connection Guide for client selection and port compatibility.


⚠️ Known Issues

See Troubleshooting Guide for detailed solutions and platform-specific workarounds.


πŸ“„ License

Copyright Β© 2026 Suwatchai K (Mobizt).

See LICENSE for full terms.


πŸ“˜ Advanced Usage

For developers who need deeper control, debugging, or custom command support, see Advanced Usage for:


🧯 Troubleshooting Guide

If you encounter crashes, SSL handshake failures, or unexpected behavior on ESP8266, ESP32, or Renesas boards, see the Troubleshooting Guide for:


🌐 Connection Guide

To learn how to select the correct ports and SSL/network clients for your board, see the Connection Guide for: