1. Products
  2.   Email
  3.   Java
  4.   Email4J

Free Java API for Email Management

Open Source Java library that supports access, read, send Email messages. You can add attachments, mark emails,  move messages, delete a particular email inside Java apps.

Email4J is an open source Java library that enables software developers to handle tasks related to email management inside their own Java applications without worrying about the internal complexities. The library is very useful and easy to handle. It supports features like composing email messages, sending emails, adding headers and attachments, copying emails, reading email messages, marking emails, moving messages, deleting a particular email, listing folders, and much more.

Email4J is a high-level java library built on top of the javax.mail API that provides the capability for handling and sending email messages with ease. The library supports connectivity with different email clients such as SmtpClient, Pop3Client, and ImapClient. By using these clients you can easily access and manage your emails. Each client has a particular set of operations and works underlying the used protocol.

Previous Next

Getting Started with Email4J

The easiest way to install Email4J is via GitHub. Please install it using the following command for easy installation.

Install Email4J via GitHub

git clone --depth=1 https://github.com/juandesi/email4j.git 

Dependency that needs to be added to pom.xml file is,

Maven Repository


Accessing and Reading Email via Java Library

The free Email4J library enables Java developers to access & read email messages inside their own applications with a couple of lines of Java code. Firstly you need to provide the correct path to the folder containing the emails. The library also enables users to view folders and emails inside these folders. You can easily retrieve information related to email messages such as email Subject, attachments, email body, recipient lists, and much more.

Send Email via SMTPClient

The open source Java library Email4J enables software developers to send email messages by using the Simple Mail Transfer Protocol (SMTP). The client mainly focuses on the operation to send the mail to the specified recipients that it receives. You can also include an attachment to an email message. Firstly you need to create the attachment and then later can add it to the message. The library has provided a simple builder, that can be used to build outgoing emails.

Send Email via SMTPClient

SmtpClient client = new SmtpClient("juan", "desimoni", "juan.smtp.host", SmtpClient.DEFAULT_SMTP_PORT, new ClientConfiguration());
client.send(email) // pre-built outgoing email.

Manage Emails via IMAPClient

The free Java library Email4J has provided the capability to access and manage email messages by using the Internet Message Access Protocol (IMAP). The ImapClient directly communicates with a mailbox and users can easily retrieve, read, move, mark, or delete email messages. You need to provide a correct path to the folder containing the emails and the client will retrieve all of them with ease.