| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
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, OpenPGP/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
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. The 10.x libraries require Java 11 or newer; 9.x is the last line that runs on Java 8. After 10.0.0, 9.x is maintenance-only: new work goes to 10.x, while critical fixes may be backported when that can be done safely without dropping Java 8 support.
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId>
<version>9.3.2</version>
</dependency>implementation 'org.simplejavamail:simple-java-mail:9.3.2'SimpleJavaMail mail = SimpleJavaMail.fromDefaults();
Email email = mail.emailBuilder().startingBlank()
.from("Sender", "sender@example.org")
.withRecipients(RecipientBuilder.to("Recipient", "recipient@example.net"))
.withSubject("It works")
.withPlainText("Your first Simple Java Mail message.")
.buildEmail();
Mailer mailer = mail.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. mailer.validate(email) applies that Mailer's defaults and overrides and rehearses the complete MIME message without connecting to SMTP. The complete getting-started guide explains each step.
| Job | Support |
|---|---|
| Messages and MIME | Plain text and HTML alternatives, embedded images, attachments, calendar content, headers, encodings, and the corresponding multipart structure. |
| Shared message rules | Recipient builders, address validation, defaults, enforced overrides, bounce addresses, receipts, and maximum message size. |
| Security | TLS and SMTPS, server identity and certificate checks, fixed or refresh-aware OAuth2 tokens, header-injection protection, DKIM, and S/MIME. |
| Delivery | Synchronous and asynchronous sends, a scoped open connection, simple batches, connection pools, and independently configured SMTP clusters. |
| Diagnostics | Connection tests, message validation, configuration inspection, Jakarta Mail debug routing, logging integrations, and SMTP submission replies. |
| Conversion and interoperability | Conversion between Email, MimeMessage, and EML, send-ready serialization, Outlook .msg conversion, and custom sending logic. |
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.
SimpleJavaMail.fromDefaults() resolves the conventional classpath file, environment variables, and system properties into one lazy immutable snapshot. For explicit source ordering or more than one mail setup in the same JVM, build a SimpleJavaMailConfig with ConfigLoader.builder() and pass it to SimpleJavaMail.withConfig(config).
This leaves application code to describe each email while shared rules stay in one reusable place.
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.
| Requirement | Artifact |
|---|---|
| Default Angus SMTP provider and delivery adapter (included transitively; exclude it only when replacing the provider) | angus-mail-provider-module |
| DKIM domain signing | dkim-module |
| S/MIME signing, encryption, and reading | smime-module |
| OpenPGP/MIME signing, encryption, verification, and decryption | openpgp-module |
| Pooled and clustered delivery | batch-module |
| Authenticated SOCKS proxies | authenticated-socks-module |
| Outlook .msg parsing and conversion | outlook-module |
| Spring-managed configuration | spring-module |
| Command-line sending and validation | cli-module (Java 17+; the other modules require Java 11+) |
| OSGi and Apache Karaf | karaf-module |
The modules guide lists each coordinate, its main transitive dependencies, and the capabilities it enables.
Simple Java Mail handles the higher-level work involved in outbound email while keeping Jakarta Mail within reach. When needed, you can:
| If you want to... | Start here |
|---|---|
| Send the first message | Get started |
| Build rich content and recipients | Capabilities |
| Configure an application | Configuration |
| Protect transport and message content | Security |
| Test, inspect, or diagnose a send | Diagnostics |
| Understand multipart structures | MIME and interoperability |
| Choose an optional artifact | Modules |
| Compare Java mail libraries | Comparison |
| Upgrade existing code | 9.2 migration guide |
| Understand the replaceable provider boundary in 10.0 | 10.0 migration guide |
| Ask a question or contribute | Help and contribute |
The current release is 9.3.2.
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.
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.
Simple Java Mail is licensed under the Apache License 2.0.
| Back | FazBrowse Home | New Git URL |