Skip to content

EasyEmail is an open source and easy to use library to send event driven emails via Java code.

License

Notifications You must be signed in to change notification settings

akshay0709/easyemail

Repository files navigation

EasyEmail

Build Status Known Vulnerabilities Maven Central

Summary

EasyEmail is an open source and easy to use library to send event driven emails via Java code. EasyEmail is a wrapper around JavaMail which allows developers to send event driven emails with less than 10 lines of code. As a developer you do not need to understand or know the internal configurations to send an email over SMTP in Java, EasyEmail will do it for you behind the scenes. EasyEmail is a lightweight and 5.32kb in size. Simply tell EasyEmail what to use and what you want and you are all set.

Currently, EasyEmail supports following features:

  • Text/Html email over SSL / TLS
  • Text/Html email with attachments over SSL / TLS

Note: EasyEmail doesn't support sending emails without authentication.

Adding EasyEmail to your build

Maven:

<dependency>
  <groupId>com.github.akshay0709</groupId>
  <artifactId>easyemail</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle:

dependencies {
 compile 'com.github.akshay0709:easyemail:1.0.0'
}

Usage

To send simple emails using EasyEmail, refer the following code snippet:

// Import package
import com.github.akshay0709.easyemail.*;

// Your SMTP server configurations (authtype = SSL or TLS)
EasyEmail em = new EasyEmail("smtp.yourhost.com", "yourport", "authtype");

// Senders email and password
em.setIdentity("[email protected]", "senderspassword");

//To send email body as text
em.setBasicInfo("subject", "emailbody").toText();

// recipient
em.send("[email protected]");

To send an email as HTML

//To send email body as html
em.setBasicInfo("subject", "emailbody").toHtml();

To send email with attachments

// To send single attachment of type File
em.addAttachment(file)

// List of attachments of type File to send multiple attachments
// List<Files> files = new ArrayList<>();
em.addAttachment(files)

To send email to multiple recipients

// Multiple recipients
//List<String> emails = new ArrayList<>()
for (String email : emails) {
    em.send(email);
}

About

EasyEmail is an open source and easy to use library to send event driven emails via Java code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages