EmailBuilderMessages and recipient rules
Compose plain text, HTML, embedded images, attachments, and calendar content. Then centralize validation, defaults, forced overrides, bounce handling, receipts, and per-recipient S/MIME certificates.
Send a well-formed email with a small fluent API. If you later need DKIM, S/MIME, proxies, batch sending, or multiple SMTP clusters, you keep using the same builders and mailer.
Email email = EmailBuilder.startingBlank()
.from("Sender", "sender@example.org")
.withRecipients(new RecipientBuilder()
.withAddress("recipient@example.net")
.withType(TO)
.build())
.withSubject("It works")
.withPlainText("Your first message.")
.buildEmail();
mailer.sendMail(email);
250 2.0.0 queued
Build, protect, send
Start with the message. Add security, shared defaults, and faster delivery only when you need them.
Rich messages and recipients without constructing MIME trees.
Message APIConfigure a mailer once with server settings, defaults, overrides, or Spring.
ConfigurationTransport policy, OAuth2, DKIM, S/MIME, and injection protection.
SecuritySend once, keep a connection open, or use pooled SMTP clusters.
250 acceptedTest the connection, inspect settings, capture debug output, and read server replies.
DiagnosticsAdd the module you need, use raw Jakarta Mail properties, or provide your own send operation.
Extension pointsThe same API as needs grow
Your first mailer can stay small. When you add signing, validation, proxies, or pooling, those settings stay with the mailer instead of spreading through every place that sends an email.
See why the API holds up.withSMTPServer(host, port, user, password)
.withTransportStrategy(SMTP_TLS)
.withDefaultDkimSigning(dkimConfig)
.async().withClusterKey(workload)
Less common, still supported
Most applications never need these. The ones that do should not have to replace their mail library or invent infrastructure around it.
Many servers, one mailer
batch-moduleGive each workload its own connection pool and set of SMTP servers. That can isolate tenants, use more than one provider, or keep transactional mail separate from batch work.
Configure clustersNetwork constraints
authenticated-socks-moduleSend through a SOCKS proxy that requires a username and password without changing the mailer configuration model.
Configure a proxyReference when you need it
Ready when you are
Start with simple-java-mail. Add another module only when you need features such as DKIM, S/MIME, pooling, or Spring integration.
org.simplejavamail:simple-java-mail:9.2.0
Get started