Jakarta Mail (formerly JavaMail) is a
Jakarta EE
Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
API used to send and receive
email via
SMTP,
POP3 and
IMAP. Jakarta Mail is built into the
Java EE platform, but also provides an optional package for use in
Java SE.
The current version is 2.1.1, released on December 15, 2022. Another
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
Jakarta Mail implementation exists - GNU JavaMail - while supporting only version 1.3 of JavaMail specification, it provides the only free
NNTP backend, which makes it possible to use this technology to read and send
news group
A Usenet newsgroup is a repository usually within the Usenet system, for messages posted from users in different locations using the Internet. They are discussion groups and are not devoted to publishing news. Newsgroups are technically distinct ...
articles.
As of 2019, the software is known as Jakarta Mail, and is part of the ''Jakarta EE'' brand (formerly known as ''Java EE'').
The reference implementation is part of the Eclipse Angus project https://projects.eclipse.org/projects/ee4j.angus
Maven co-ordinates of the relevant projects required for operation are:
* mail API: jakarta.mail:jakarta.mail-api:2.1.1
* mail implementation: org.eclipse.angus:angus-mail:2.0.1
* multimedia extensions: jakarta.activation:jakarta.activation-api:2.1.1
Licensing
Jakarta Mail is hosted as an
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project on
Eclipse.org
The Eclipse Foundation AISBL is an independent, Europe-based not-for-profit corporation that acts as a steward of the Eclipse open source software development community, with legal jurisdiction in the European Union. It is an organization suppo ...
under its new name ''Jakarta Mail''.
Most of the Jakarta Mail source code is licensed under the following licences:
*
EPL-2.0
*
GPL-2.0 with Classpath Exception license
* The source code for the demo programs is licensed under the BSD license
Examples
import jakarta.mail.*;
import jakarta.mail.internet.*;
import java.time.*;
import java.util.*;
// Send a simple, single part, text/plain e-mail
public class TestEmail
Sample Code to Send Multipart E-Mail, HTML E-Mail and File Attachments
package org.example;
import jakarta.activation.*;
import jakarta.mail.*;
import jakarta.mail.internet.*;
import java.io.*;
import java.time.*;
import java.util.*;
public class SendMailUsage
References
External links
*
Jakarta Mail EE4J project pageobsolete, but contains code for an NNTP backend
{{Jakarta EE
Email
Java platform
Java enterprise platform