Apache Commons logo Commons Email

Commons Email

Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.

You must choose between the Javax org.apache.commons:commons-email2-javax or Jakarta org.apache.commons:commons-email2-jakarta implementation. Either one will bring in the Core org.apache.commons:commons-email2-core module when using Maven.

See the modules page.

Some of the mail classes that are provided are as follows:

  • SimpleEmail - This class is used to send basic text based emails.
  • MultiPartEmail - This class is used to send multipart messages. This allows a text message with attachments either inline or attached.
  • HtmlEmail - This class is used to send HTML formatted emails. It has all of the capabilities as MultiPartEmail allowing attachments to be easily added. It also supports embedded images.
  • ImageHtmlEmail - This class is used to send HTML formatted emails with inline images. It has all of the capabilities as HtmlEmail but transform all image references to inline images.
  • EmailAttachment - This is a simple container class to allow for easy handling of attachments. It is for use with instances of MultiPartEmail and HtmlEmail.

Documentation

The Commons Email User Guide covers many typical cases and provides several useful examples.

The Javadoc API documents are available online:

The git repository can be browsed.

Releases

The latest version requires Java 8 - Download now!
The full change log is available

For previous releases, see the Apache Archive.

Support

The commons mailing lists act as the main support forum. The user list is suitable for most library usage queries. The dev list is intended for the development discussion. Please remember that the lists are shared between all commons components, so prefix your email by [email].

Issues may be reported via ASF JIRA.