Git Product home page Git Product logo

simple-java-mail's Introduction

APACHE v2 License Latest Release Javadocs Build Status Codacy

Simple Java Mail

Simple Java Mail is the simplest to use lightweight mailing library for Java, while being able to send complex emails including authenticated socks proxy(!), attachments, embedded images, custom headers and properties, robust address validation, build pattern and even DKIM signing and external configuration files with property overriding. Just send your emails without dealing with RFC's.

The Simple Java Mail library is a thin layer on top of the JavaMail smtp mailing API that allows users to define emails on a high abstraction level without having to deal with mumbo jumbo such a 'multipart' and 'mimemessage'.

ConfigLoader.loadProperties("simplejavamail.properties"); // optional default
ConfigLoader.loadProperties("overrides.properties"); // optional extra

Email email = new Email();

email.addRecipient("lollypop", "[email protected]", Message.RecipientType.TO);
email.setReplyToAddress("lollypop", "[email protected]");
email.addRecipient("C. Cane", "[email protected]", Message.RecipientType.TO);
email.addRecipient("C. Bo", "[email protected]", Message.RecipientType.CC);
email.setSubject("hey");
email.setText("We should meet up! ;)");
email.setTextHTML("<img src='cid:wink1'><b>We should meet up!</b><img src='cid:wink2'>");
email.addEmbeddedImage("wink1", imageByteArray, "image/png");
email.addEmbeddedImage("wink2", imageDatesource);
email.addAttachment("invitation", pdfByteArray, "application/pdf");
email.addAttachment("dresscode", odfDatasource);

email.signWithDomainKey(privateKeyData, "somemail.com", "selector");

new Mailer(
		new ServerConfig("smtp.host.com", 587, "[email protected]", "password"),
		TransportStrategy.SMTP_TLS,
		new ProxyConfig("socksproxy.host.com", 1080, "proxy user", "proxy password")
).sendMail(email);

Simple Java Mail is available in Maven Central:

<dependency>
    <groupId>org.codemonkey.simplejavamail</groupId>
    <artifactId>simple-java-mail</artifactId>
    <version>3.1.1</version>
</dependency>

Latest Progress

v4.0.0 (unreleased)

  • #41: added support for parallel batch processing
  • #42: added support for config files
  • #43: switched to log4j2 including default config
  • #38: added support for anonymous proxy
  • #38: added support for authenticated proxy

v3.1.1

Major feature: DKIM support!

  • #36: Added proper toString and equals methods for the Email classes
  • #33: Added support for DKIM domain key signing

v3.0.2

  • #35: added proper .equals() and .toString() methods
  • #34: Fixed bug when disposition is missing (assume it is an attachment)
  • #00: added findbugs support internally

v3.0.1

  • #31: Fixed EmailAddressCriteria.DEFAULT and clarified Javadoc

v3.0.0

  • #30: Improved the demonstration class to include attachments and embedded images
  • #29: The package has been restructured for future maintenance, breaking backwards compatibility
  • #28: Re-added improved email validation facility
  • #22: Added conversion to and from MimeMessage. You can now consume and produce MimeMessage objects with simple-java-mail

v2.5.1

  • #25: Added finally clause that will always close socket properly in case of an exception

v2.5

  • #24: Updated dependencies SLF4J to 1.7.13 and switched to the updated javax mail package com.sun.mail:javax.mail 1.5.5

v2.4

  • #21: builder API uses CC and BCC recipient types incorrectly

v2.3

  • #19: supporting custom Session Properties now and emergency access to internal Session object.

v2.2

  • #3: turned off email regex validation by default, with the option to turn it back on
  • #7: fixed NullPointerException when using your own Session instance
  • #10: properly UTF-8 encode recipient addresses
  • #14: switched to SLF4J, so you can easily use your own selected logging framework
  • #17: Added fluent interface for building emails (see manual for an example)

v2.1

  • fixed character encoding for reply-to, from, to, body text and headers (to UTF-8)
  • fixed bug where Recipient was not public resulting in uncompilable code when calling email.getRecipients()

v2.0

  • added support for adding open headers, such as 'X-Priority: 2'

v1.9.1

  • updated for Maven support

v1.9

  • added support for JavaMail's reply-to address
  • made port optional as to support port defaulting based on protocol
  • added transport strategy default in the createSession method
  • tightened up thrown exceptions (MailException instead of RuntimeException)
  • added and fixed JavaDoc

v1.8

  • Added support for TLS (tested with gmail)

v1.7

Added support for SSL! (tested with gmail)

  • improved argument validation when creating a Mailer without preconfigured Session instance

known possible issue: SSL self-signed certificates might not work (yet). Please let me know by e-mail or create a new issue

v1.6

Completed migration to Java Simple Mail project.

  • removed all Vesijama references
  • updated TestMail demonstration class for clarification
  • updated readme.txt for test run instructions
  • included log4j.properties

simple-java-mail's People

Contributors

bbottema avatar jaredjstewart 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.