Repolode
bbottema

bbottema/simple-java-mail

Java library that wraps Jakarta Mail in a simple builder API for composing and sending well-formed MIME emails over SMTP.

Stars
1,293
Forks
275
Open issues
18
Last commit
15 hours ago

What is it?

Simple Java Mail is a Java library for building and sending email. It produces well-formed MIME messages through a fluent builder API, covering plain text and HTML alternatives, embedded images, attachments, calendar content, and custom headers. Shared rules such as default recipients, enforced overrides, bounce addresses, and maximum message size can be configured once on a reusable Mailer instead of at every call site.

The library handles transport and security concerns, including TLS and SMTPS, certificate checks, OAuth2 tokens, header-injection protection, DKIM signing, and S/MIME. It also offers synchronous and asynchronous sends, batches, connection pools, and SMTP clusters, along with connection tests and message validation for diagnostics. Underneath, it is built on Jakarta Mail and Angus Mail, so a custom Session or raw Jakarta Mail properties can still be used.

Optional modules add DKIM, S/MIME, batch delivery, authenticated SOCKS proxies, Outlook .msg conversion, Spring configuration, a command-line sender, and OSGi/Karaf support. The project targets Java 8 and later and is published to Maven Central.

Key features

  • 01Builds MIME messages with plain text and HTML alternatives, inline images, and attachments.
  • 02Configures shared defaults and enforced overrides on a reusable Mailer.
  • 03Supports TLS/SMTPS, OAuth2 tokens, DKIM signing, and S/MIME.
  • 04Provides connection tests and message validation for diagnosing sends.
  • 05Converts between Email, MimeMessage, and EML formats.

Use cases

  • Sending transactional or notification emails from a Java backend.
  • Adding DKIM or S/MIME signing to outgoing mail in a Java application.
  • Integrating email sending into a Spring Boot service via the Spring module.
  • Sending bulk mail through connection pools or SMTP clusters.

Quick start

  1. 1

    Add the core Maven dependency to your project

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

    Or add the core Gradle dependency instead

    implementation 'org.simplejavamail:simple-java-mail:9.3.9'
  3. 3

    Build an Email and send it through a Mailer configured for your SMTP server

Things to know

  • Requires a Java 8+ runtime and an SMTP server to send mail.

Topics

#java#email#smtp#jakarta-mail#mime#dkim#smime#spring#batch-processing#builder-api

FAQ

What is simple-java-mail?
Java library that wraps Jakarta Mail in a simple builder API for composing and sending well-formed MIME emails over SMTP. Simple Java Mail is a Java library for building and sending email. It produces well-formed MIME messages through a fluent builder API, covering plain text and HTML alternatives, embedded images, attachments, calendar content, and custom headers. Shared rules such as default recipients, enforced overrides, bounce addresses, and maximum message size can be configured once on a reusable Mailer instead of at every call site.
Is simple-java-mail free to use? What license does it have?
simple-java-mail is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is simple-java-mail still maintained?
Actively maintained. The last commit to simple-java-mail was on Nov 6, 2026.
What can I use simple-java-mail for?
Sending transactional or notification emails from a Java backend. Adding DKIM or S/MIME signing to outgoing mail in a Java application. Integrating email sending into a Spring Boot service via the Spring module. Sending bulk mail through connection pools or SMTP clusters.
How do I install simple-java-mail?
Add the core Maven dependency to your project: <dependency> <groupId>org.simplejavamail</groupId> <artifactId>simple-java-mail</artifactId> <version>9.3.9</version> </dependency> Or add the core Gradle dependency instead: implementation 'org.simplejavamail:simple-java-mail:9.3.9' Build an Email and send it through a Mailer configured for your SMTP server
Where can I get simple-java-mail?
The source code and installation instructions are on GitHub: https://github.com/bbottema/simple-java-mail

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects