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

Your sandbox credentials
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

    Properties is 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.enable goes with port 587. mail.smtp.ssl.enable is implicit TLS and goes with 465. Setting both makes the handshake fail.

Official documentationJakarta Mail (opens in a new tab)