wasm-smtp
Rust crates for sending mail by SMTP from WebAssembly runtimes. The project separates the protocol implementation from the runtime-specific socket code so that the same SMTP engine can be reused on every host.
Crates
| Crate | Role | Status |
|---|---|---|
wasm-smtp-core |
Environment-independent SMTP state machine and parser. | Implemented |
wasm-smtp-cloudflare |
Cloudflare Workers socket adapter for wasm-smtp-core. |
Implemented |
wasm-smtp-core is the foundation: it implements the SMTP state
machine, response parsing, command formatting, dot-stuffing, and error
classification, but does no I/O of its own. Each runtime gets its own
adapter crate that provides a Transport implementation; today, only
the Cloudflare Workers adapter is on the roadmap.
Minimum usage
From a Cloudflare Worker (the production target):
use connect_smtps;
# async
Or directly against wasm-smtp-core with any Transport you supply:
use ;
async
The body argument is a fully-formed RFC 5322 message: headers, a blank
line, then the body, with CRLF line endings. The library does not build
MIME, attach files, or compose multipart bodies.
Connection model
This release standardizes on Implicit TLS on port 465. STARTTLS is
intentionally out of scope. The TLS handshake is the responsibility of
the Transport implementation; the core sees an already-secure byte
stream.
Acceptable use
This library must not be used to deliver unsolicited bulk mail, to
impersonate other senders, or to deliver mail that violates the
operating policy of any SMTP server. See TERMS_OF_USE.md.
Documentation
Long-form documentation lives in docs/src. The mdBook structure
covers project architecture, the SMTP protocol surface, the error
taxonomy, and end-to-end usage.