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 compose email messages, sending emails, add headers and attachments, copy emails, read email messages, mark emails, move messages, delete 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 emails 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 used protocol.
At A Glance
An overview of Email4J features.
- Read emails
- CRLF injection attacks
- OST support
- Embedded images
- Add custom headers
- CLI support
- S/MIME support
- Batch processing
- Add attachments
- Batch processing
Email4J supports popular email file formats as listed below.
Simple Java Mail only requires Java run-time.
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,
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 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 list, 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 the latter can add it to the message. The library has provided a simple builder, that can be used to build the outgoing emails.
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 for you with ease.