Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
esp-idf-smtp
Lightweight SMTP client for ESP32 devices using esp_tls.
Supports implicit TLS, STARTTLS, and plaintext connections with AUTH PLAIN/LOGIN authentication. Builder pattern for email composition. Host-testable protocol logic via transport trait abstraction.
Features
- Three TLS modes: Implicit TLS (port 465), STARTTLS (port 587), Plain (port 25)
- Authentication: AUTH PLAIN and AUTH LOGIN, auto-selected from server capabilities
- Multiple recipients: To, CC, BCC with correct header generation
- RFC compliant: Dot-stuffing (RFC 5321), CRLF line endings, EHLO capability parsing
- Type-safe errors: Every failure mode has a typed error variant
- Host-testable: Protocol logic runs on any platform via
SmtpTransporttrait - Feature-gated: ESP-IDF transport behind
esp-idffeature flag
Quick Start
use ;
let config = new
.tls_mode
.credentials
.timeout_ms;
let email = builder
.from
.to
.subject
.body
.build?;
new.send?;
Feature Flags
| Feature | Default | Description |
|---|---|---|
esp-idf |
Yes | ESP-IDF transport via esp_tls. Adds esp-idf-svc dependency. |
Without esp-idf, only protocol types and the SmtpTransport trait are available — useful for host testing or providing your own transport.
# Host-only (no ESP-IDF)
[]
= { = "0.1", = false }
TLS Modes
use ;
// Gmail (implicit TLS on 465)
let config = new;
// Corporate relay (STARTTLS on 587)
let config = new
.tls_mode;
// Local test server (no TLS)
let config = new
.tls_mode;
// Self-signed server
let config = new
.skip_cert_verification;
Multiple Recipients
let email = builder
.from
.to
.to
.cc
.bcc
.subject
.body
.build?;
BCC recipients receive the email but are not included in message headers.
Host Testing
The protocol engine operates against the SmtpTransport trait. Implement it with a mock to test SMTP logic without hardware:
cargo test --no-default-features
Minimum Supported Rust Version
1.75
License
This project is licensed under the Mozilla Public License 2.0 — see LICENSE for details.
You can use this library in closed-source projects. If you modify any of the source files in this library, the modified files must be made available under the MPL-2.0 when distributed.