Core already covers well-formed MIME, reusable configuration and message rules, TLS and OAuth2, diagnostics, conversion, and simple batches. Add an optional module only when you need pooled or clustered delivery, authenticated SOCKS, DKIM, S/MIME, Outlook conversion, command-line use, Spring integration, or Karaf support.
Core
The main simple-java-mail dependency already includes the core module. Add any optional feature modules
alongside it as you need them.
Integration modules such as Spring already depend on the main library, so you do not need to declare it twice. Feature modules can be combined.
The main core dependencies are:
jakarta.mail:jakarta.mail-api: the standard mail APIorg.eclipse.angus:angus-mail: the Jakarta Mail implementationcom.sanctionco.jmail:jmail: address validation
Use the published POM on Maven Central as the authoritative list of transitive dependencies for the current release.
As of 9.0.0, the simple-java-mail and core-module jars include
Java module descriptors. Modular applications can require
org.simplejavamail directly.
Batch and clustering support
Add this library for pooled and clustered sending:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>batch-module</artifactId>
</dependency>
This adds the following 3rd party dependencies:
The module sends work asynchronously and orchestrates the optional smtp-connection-pool dependency. Use the
pooling and batch orchestration guide to compare the full Mailer integration, the standalone
callback facade, direct leases, and the Jakarta Mail or Camel provider paths. See
Mailer configuration for its settings.
A live connection pool keeps the JVM running. See Mailer lifecycle and resource ownership for orderly shutdown, including clustered Mailers.
Authenticated (SOCKS) proxy support
Add this library for authenticated SOCKS proxy servers:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>authenticated-socks-module</artifactId>
</dependency>
This adds no additional 3rd party dependencies.
Outlook support
Add this library for parsing Outlook messages:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>outlook-module</artifactId>
</dependency>
The module delegates Outlook .msg parsing to:
That parser reads the Outlook OLE container, message properties, bodies and attachments using Apache POI and related conversion libraries. Its transitive dependency set belongs to the parser and can change independently of this module.
DKIM support
Add this library for DKIM signing:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>dkim-module</artifactId>
</dependency>
This adds the following 3rd party dependencies:
S/MIME support
Add this library for sending and reading S/MIME signed or encrypted email:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>smime-module</artifactId>
</dependency>
This adds the following 3rd party dependencies:
CLI support
Normally, you would not need the CLI module on the class path, unless you wish to invoke the
static void main method from Java (see also how to use CLI).
To do so, include the following module:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>cli-module</artifactId>
</dependency>
This adds the following 3rd party dependencies:
Note: Simple Java Mail core has a 'provided' dependency on com.github.therapi:therapi-runtime-javadoc-scribe which burns Javadoc into Simple Java Mail at compile time. This cannot be made optional. If this is a real concern, an option could be to provide two versions of Simple Java Mail: one with embedded Javadoc and one without (incompatible with the Cli Module). This is currently not in scope.
Spring support
Add this library for Spring support:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>spring-module</artifactId>
</dependency>
The module integrates with the Spring libraries supplied by your application. It expects
spring-core, spring-context, and
spring-beans to be available at runtime; Spring and Spring Boot applications normally provide these already.
Apache Karaf support
Add this library for Apache Karaf support:
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>karaf-module</artifactId>
</dependency>