Java (Jakarta Mail)
Jakarta Mail with a Session and an authenticator — no framework involved.
Prerequisites
- Java 11 or later
- jakarta.mail (or javax.mail on older stacks)
1Open a session and send
Properties props = new Properties(); props.put("mail.smtp.host", "smtp.mailclutch.com"); props.put("mail.smtp.port", "587"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); Session session = Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("mc_0000000000000000", "pw_0000000000000000"); } }); Message message = new MimeMessage(session); message.setFrom(new InternetAddress("staging@example.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("anyone@example.com")); message.setSubject("Sandbox check"); message.setText("Hello from Java."); Transport.send(message);
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
mail.smtp.auth as a string
Propertiesis a string map.props.put("mail.smtp.auth", true)with a boolean is ignored, and the session then tries to send unauthenticated.starttls.enable vs ssl.enable
mail.smtp.starttls.enablegoes with port 587.mail.smtp.ssl.enableis implicit TLS and goes with 465. Setting both makes the handshake fail.
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
- .NETMailKit: connect, auth, send
- PHPPHPMailer, no framework
- Pythonsmtplib, standard library
- Rustlettre over a STARTTLS relay