Cookbook: SMTP

Accept-all server

cargo run -p smtp-server -- 127.0.0.1:2525
# optional second arg: hostname (default localhost)

Send

cargo run -p smtp-send -- 127.0.0.1:2525 from@example.com to@example.com

Env: SMTP_SUBJECT, SMTP_BODY.

Simple relay

There is no example binary yet. Wire SimpleRelayService as in the SMTP guide (MX open relay for lab use). Covered by hopf-smtp integration tests.

Local delivery

cargo run -p smtp-local -- 127.0.0.1:2525 localhost example.com ./mail
cargo run -p smtp-send -- 127.0.0.1:2525 alice@elsewhere.test bob@example.com

APPENDs to ./mail/bob/ (Maildir++). Wrong-domain RCPT is relay-denied.

Sources: examples/smtp, examples/smtp-local, examples/smtp-send.