Giter Club home page Giter Club logo

simple-java-mail's Introduction

simple-java-mail

This is a simple java library that helps you to send emails from your java projects.

Visitor Count

Installation

Just download the required version of jar from releases and add .jar file to project build path

Usage

You need to implement MailAuth interface.

package io.github.itsmrajesh.samplemail;

public interface MailAuth {

	String getHostMailAddress();

	String getHostPassword();

}
import io.github.itsmrajesh.samplemail.MailAuth;;

public class MyMailAuth implements MailAuth {

	@Override
	public String getHostmailaddress() {
		return "[email protected]";
	}

	@Override
	public String getHostpassword() {
		return "mysecret@apppassword"; // your password 
	}

}

After implmenting MailAuth interface, you need invoke following method MailService.sendMail and pass the all parameters to sendMail method.

//create object for newly implemented class and pass it in following method

MailAuth mailAuth = new MyMailAuth(); 

boolean status = MailService.sendMail(MailAuth mailAuth, String recipientMailAddress, String mailSubject, String message);

status will be true when your mail sent is successfully.

Example

import io.github.itsmrajesh.samplemail.MailAuth;

public class SimpleMailAppTester {

 public static void main(String[] args) {
		
  MailAuth mailAuth = new MyMailAuth();
		
  String recipientMailAddress = "[email protected]";
  String mailSubject = "Thank You-Simple Mail"; // This is your mail subject
  String message = "Hello User, <br> <h4>Thanks for using our services.</h4> <br> <br> Thank You, <br> Team Simple Mail.";
		
  System.out.println("Please wait while we send your mail.");
		
  boolean mailStatus = SimpleMailService.sendMail(mailAuth, recipientMailAddress, mailSubject, message);
		
  if (mailStatus) {
	System.out.println("Mail Sent Successfully!");
  } else {
	  System.out.println("Failed in sending mail.");
  }
  
 } // End of main method
 
} // End of Class

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

simple-java-mail's People

Contributors

itsmrajesh avatar

Watchers

 avatar  avatar

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.