A self-hosted mail server packaged as a set of Docker images, covering SMTP, IMAP, POP3 and webmail.
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
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
Or add the core Gradle dependency instead
implementation 'org.simplejavamail:simple-java-mail:9.3.9' - 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
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
All-in-one mail server in Go that handles SMTP sending and receiving, IMAP storage, and DKIM/SPF/DMARC authentication in one daemon.
A full-featured, secure mail server in Go for self-hosting your own domain's email with low maintenance.
A highly scalable, event-driven SMTP mail server in Node.js whose behaviour is extended through a plugin system.
A single-file, self-hosted private email server with SMTP, POP3 and IMAP support plus a web mail management interface for your own domain.
A long-established PHP library for composing and sending emails, with built-in SMTP, attachments, HTML bodies and SMTP authentication.