bbottema/simple-java-mail

Simple API, Complex Emails (Jakarta Mail smtp wrapper)

Java

1,293

2,286 commits

updated Oct 7, 2026

See the code

README

Simple Java Mail

Maven Central Javadocs Java 8+ Apache-2.0

Simple to use. Built for the real world.

Simple Java Mail builds well-formed MIME through a streamlined Java API. That same API covers reusable message rules, transport security, DKIM, S/MIME, diagnostics, conversion, authenticated SOCKS, and advanced SMTP delivery.

Jakarta Mail provides the standard mail API, and Angus Mail provides its transport implementation. You can still supply a Session, access the generated MimeMessage, set raw Jakarta Mail properties, or provide the final send operation.

Get started · Capabilities · Modules · Javadocs · 9.2 migration guide · Compare libraries

Send a first email

Simple Java Mail is published to Maven Central. Start with simple-java-mail, the core dependency. Add a feature module only when you need it, using the same version as the core dependency. Java 8 is the source, target, and minimum supported runtime.

Maven

<dependency>
    <groupId>org.simplejavamail</groupId>
    <artifactId>simple-java-mail</artifactId>
    <version>9.3.5</version>
</dependency>

Gradle

implementation 'org.simplejavamail:simple-java-mail:9.3.5'

Build and send

Email email = EmailBuilder.startingBlank()
    .from("Sender", "sender@example.org")
    .withRecipients(new RecipientBuilder()
        .withName("Recipient")
        .withAddress("recipient@example.net")
        .withType(Message.RecipientType.TO)
        .build())
    .withSubject("It works")
    .withPlainText("Your first Simple Java Mail message.")
    .buildEmail();

Mailer mailer = MailerBuilder.withSMTPServer(
        System.getenv("SMTP_HOST"),
        587,
        System.getenv("SMTP_USER"),
        System.getenv("SMTP_PASSWORD"))
    .withTransportStrategy(TransportStrategy.SMTP_TLS)
    .buildMailer();

mailer.sendMail(email);

The port and transport strategy must match your SMTP server. Build the Mailer once, reuse it, and close it during application shutdown. Before sending, mailer.testConnection() checks the SMTP path and mailer.validate(email) checks the message. The complete getting-started guide explains each step.

What the API handles

JobSupport
Messages and MIMEPlain text and HTML alternatives, embedded images, attachments, calendar content, headers, encodings, and the corresponding multipart structure.
Shared message rulesRecipient builders, address validation, defaults, enforced overrides, bounce addresses, receipts, and maximum message size.
SecurityTLS and SMTPS, server identity and certificate checks, fixed or refresh-aware OAuth2 tokens, header-injection protection, DKIM, and S/MIME.
DeliverySynchronous and asynchronous sends, a scoped open connection, simple batches, connection pools, and independently configured SMTP clusters.
DiagnosticsConnection tests, message validation, configuration inspection, Jakarta Mail debug routing, logging integrations, and SMTP submission replies.
Conversion and interoperabilityConversion between Email, MimeMessage, and EML, send-ready serialization, Outlook .msg conversion, and custom sending logic.

Configure once, reuse everywhere

A Mailer keeps SMTP settings, transport policy, defaults, overrides, validation, signing, proxy configuration, and delivery behavior out of individual call sites. Configure it with the Java builder API, property files, system properties, or environment variables, or let the Spring module create and inject it.

This leaves application code to describe each email while shared rules stay in one reusable place.

Add only what you need

Optional modules extend the same API and add their dependencies only when selected. Use the same Simple Java Mail version for every module. Some integration artifacts already depend on simple-java-mail; the modules guide notes when you do not need to declare it separately.

The modules guide lists each coordinate, its main transitive dependencies, and the capabilities it enables.

Jakarta Mail remains available

Simple Java Mail handles the higher-level work involved in outbound email while keeping Jakarta Mail within reach. When needed, you can:

Documentation by task

If you want to...Start here
Send the first messageGet started
Build rich content and recipientsCapabilities
Configure an applicationConfiguration
Protect transport and message contentSecurity
Test, inspect, or diagnose a sendDiagnostics
Understand multipart structuresMIME and interoperability
Choose an optional artifactModules
Compare Java mail librariesComparison
Upgrade existing code9.2 migration guide
Ask a question or contributeHelp and contribute

Current release

The current release is 9.3.5.

GitHub release · Maven Central artifacts · Migration guide · Complete release history

Read the migration guide before upgrading from an older release when source compatibility, defaults, security behavior, or configuration precedence matters to your application.

Develop and contribute

Simple Java Mail is open source under the Apache License 2.0. It was first published in 2009 and is maintained by Benny Bottema with contributions from its users and the surrounding open-source projects.

  • Use the issue tracker for reproducible bugs and concrete feature ideas.
  • Read DEVELOPMENT.md for the supported JDKs and local build setup.
  • Read the project mechanisms catalogue before changing module loading, CLI metadata, MIME selection, proxy bridging, concurrency, or non-null instrumentation.
  • Follow the API expansion workflow when adding a public field or builder method.
  • Use Help and contribute to choose the right public channel or arrange private follow-up for a sensitive report.

License

Simple Java Mail is licensed under the Apache License 2.0.

batch-processing
builder-api
cli-support
configurable
conversion
dkim
dmarc
email
high-performance
jakarta-mail
java
java-mail
javamail
oauth2
outlook
proxy
smime
smtp
smtp-client
spring-support

bbottema/simple-java-mail

Simple API, Complex Emails (Jakarta Mail smtp wrapper)

Java

1,293

2,286 commits

updated Oct 7, 2026

See the code

README

Simple Java Mail

Maven Central Javadocs Java 8+ Apache-2.0

Simple to use. Built for the real world.

Simple Java Mail builds well-formed MIME through a streamlined Java API. That same API covers reusable message rules, transport security, DKIM, S/MIME, diagnostics, conversion, authenticated SOCKS, and advanced SMTP delivery.

Jakarta Mail provides the standard mail API, and Angus Mail provides its transport implementation. You can still supply a Session, access the generated MimeMessage, set raw Jakarta Mail properties, or provide the final send operation.

Get started · Capabilities · Modules · Javadocs · 9.2 migration guide · Compare libraries

Send a first email

Simple Java Mail is published to Maven Central. Start with simple-java-mail, the core dependency. Add a feature module only when you need it, using the same version as the core dependency. Java 8 is the source, target, and minimum supported runtime.

Maven

<dependency>
    <groupId>org.simplejavamail</groupId>
    <artifactId>simple-java-mail</artifactId>
    <version>9.3.5</version>
</dependency>

Gradle

implementation 'org.simplejavamail:simple-java-mail:9.3.5'

Build and send

Email email = EmailBuilder.startingBlank()
    .from("Sender", "sender@example.org")
    .withRecipients(new RecipientBuilder()
        .withName("Recipient")
        .withAddress("recipient@example.net")
        .withType(Message.RecipientType.TO)
        .build())
    .withSubject("It works")
    .withPlainText("Your first Simple Java Mail message.")
    .buildEmail();

Mailer mailer = MailerBuilder.withSMTPServer(
        System.getenv("SMTP_HOST"),
        587,
        System.getenv("SMTP_USER"),
        System.getenv("SMTP_PASSWORD"))
    .withTransportStrategy(TransportStrategy.SMTP_TLS)
    .buildMailer();

mailer.sendMail(email);

The port and transport strategy must match your SMTP server. Build the Mailer once, reuse it, and close it during application shutdown. Before sending, mailer.testConnection() checks the SMTP path and mailer.validate(email) checks the message. The complete getting-started guide explains each step.

What the API handles

JobSupport
Messages and MIMEPlain text and HTML alternatives, embedded images, attachments, calendar content, headers, encodings, and the corresponding multipart structure.
Shared message rulesRecipient builders, address validation, defaults, enforced overrides, bounce addresses, receipts, and maximum message size.
SecurityTLS and SMTPS, server identity and certificate checks, fixed or refresh-aware OAuth2 tokens, header-injection protection, DKIM, and S/MIME.
DeliverySynchronous and asynchronous sends, a scoped open connection, simple batches, connection pools, and independently configured SMTP clusters.
DiagnosticsConnection tests, message validation, configuration inspection, Jakarta Mail debug routing, logging integrations, and SMTP submission replies.
Conversion and interoperabilityConversion between Email, MimeMessage, and EML, send-ready serialization, Outlook .msg conversion, and custom sending logic.

Configure once, reuse everywhere

A Mailer keeps SMTP settings, transport policy, defaults, overrides, validation, signing, proxy configuration, and delivery behavior out of individual call sites. Configure it with the Java builder API, property files, system properties, or environment variables, or let the Spring module create and inject it.

This leaves application code to describe each email while shared rules stay in one reusable place.

Add only what you need

Optional modules extend the same API and add their dependencies only when selected. Use the same Simple Java Mail version for every module. Some integration artifacts already depend on simple-java-mail; the modules guide notes when you do not need to declare it separately.

The modules guide lists each coordinate, its main transitive dependencies, and the capabilities it enables.

Jakarta Mail remains available

Simple Java Mail handles the higher-level work involved in outbound email while keeping Jakarta Mail within reach. When needed, you can:

Documentation by task

If you want to...Start here
Send the first messageGet started
Build rich content and recipientsCapabilities
Configure an applicationConfiguration
Protect transport and message contentSecurity
Test, inspect, or diagnose a sendDiagnostics
Understand multipart structuresMIME and interoperability
Choose an optional artifactModules
Compare Java mail librariesComparison
Upgrade existing code9.2 migration guide
Ask a question or contributeHelp and contribute

Current release

The current release is 9.3.5.

GitHub release · Maven Central artifacts · Migration guide · Complete release history

Read the migration guide before upgrading from an older release when source compatibility, defaults, security behavior, or configuration precedence matters to your application.

Develop and contribute

Simple Java Mail is open source under the Apache License 2.0. It was first published in 2009 and is maintained by Benny Bottema with contributions from its users and the surrounding open-source projects.

  • Use the issue tracker for reproducible bugs and concrete feature ideas.
  • Read DEVELOPMENT.md for the supported JDKs and local build setup.
  • Read the project mechanisms catalogue before changing module loading, CLI metadata, MIME selection, proxy bridging, concurrency, or non-null instrumentation.
  • Follow the API expansion workflow when adding a public field or builder method.
  • Use Help and contribute to choose the right public channel or arrange private follow-up for a sensitive report.

License

Simple Java Mail is licensed under the Apache License 2.0.

batch-processing
builder-api
cli-support
configurable
conversion
dkim
dmarc
email
high-performance
jakarta-mail
java
java-mail
javamail
oauth2
outlook
proxy
smime
smtp
smtp-client
spring-support

Project health

Overall

3.0/10

Maintained

10/10

Code review

0/10
OpenSSF Scorecard

Latest release

9.3.5 · Sep 19, 2026

Releases this year

21

Significant stargazers

jiangying

33 followers · starred Oct 2021

Ricky

149 followers · starred Aug 2021

probe

79 followers · starred Apr 2024

tanayabh

12 followers · starred Apr 2016