GithubHelp home page GithubHelp logo

akshay0709 / easyemail Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 158 KB

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

Home Page: https://github.com/akshay0709/easyemail

License: MIT License

Java 100.00%
easyemailer easyemail javamail ssl tls smtp

easyemail's Introduction

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);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.