Rust
lettre, with a STARTTLS relay pointed at a sandbox.
Prerequisites
- Rust 1.70 or later
- lettre 0.11
1Add lettre
[dependencies] lettre = "0.11"
2Send a test message
use lettre::transport::smtp::authentication::Credentials; use lettre::{Message, SmtpTransport, Transport}; fn main() -> Result<(), Box<dyn std::error::Error>> { let email = Message::builder() .from("staging@example.com".parse()?) .to("anyone@example.com".parse()?) .subject("Sandbox check") .body(String::from("Hello from Rust."))?; let credentials = Credentials::new( "mc_0000000000000000".to_owned(), "pw_0000000000000000".to_owned(), ); let mailer = SmtpTransport::starttls_relay("smtp.mailclutch.com")? .port(587) .credentials(credentials) .build(); mailer.send(&email)?; Ok(()) }
Watch it land
Open the sandbox and the message is there — rendered HTML, plain text, raw source, attachments, and the SPF, DKIM and DMARC verdicts. It updates live, so you can leave it open next to your terminal.
Nothing is ever delivered onward, whatever address you send to; claim the sandbox with an account and it stays.
Awaiting your email
Send from any address; it stops here rather than going onward. The sandbox keeps what it catches for 24 hours.
Go further
starttls_relay vs relay
starttls_relayconnects in the clear and upgrades — that is port 587.relayis implicit TLS on 465. Pick one; mixing them is the usual cause of a handshake error.
Other stacks
The same four values in another dialect. Every guide below is filled in with the sandbox pair at the top of this page.
Frameworks and languages
- LaravelFive .env variables, no package
- SymfonyOne MAILER_DSN
- DjangoFive settings, nothing installed
- RailsAction Mailer smtp_settings
- Node.jsA Nodemailer transport
- Next.jsRoute Handler or Server Action
- Gonet/smtp, standard library
- SpringFive Spring Boot properties
- JavaJakarta Mail, no framework
- .NETMailKit: connect, auth, send
- PHPPHPMailer, no framework
- Pythonsmtplib, standard library