Simple API, Complex Emails (JavaMail smtp wrapper)

Overview

APACHE v2 License Latest Release Javadocs Codacy Java 1.7+

Simple Java Mail

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

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

simplejavamail.org

Simple Java Mail is also available in Maven Central:

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

Latest Progress

v6.5.0 (16-February-2021)

  • #298 Enhancement: Nested Outlook messages aren't discarded anymore, but parsed to serialized Email objects
  • #292 Bugfix: NullPointerException in SmimeUtilFixed when protocol is missing (which is valid)
  • #289 Bugfix: Support multiple headers with same key

This release breaks all GET/SET api regarding headers used as map (Map<String, T> -> Map<String, Collection<T>>) This release might break api in the rare case you relied on the attachment list and you have nested Outlook .msg attachments (previously omitted in the results)

v6.4.0 - v6.4.5

  • v6.4.5 (13-Februari-2021): #306 Maintenance: Update outlook-message-parser to 1.7.9
  • v6.4.5 (13-Februari-2021): #304 Regression bugfix: batch-module needed for sending mails async, basic version should work without
  • v6.4.5 (13-Februari-2021): #303 Bugfix: EML Attachments are modified/have the wrong size
  • v6.4.4 (25-October-2020): #294 Always invoke async success/exception handlers even if set after sending email (behaving more like promises/futures)
  • v6.4.4 (25-October-2020): #291 On Exception only log the email ID at error level and log the whole email at trace level
  • v6.4.4 (25-October-2020): #290 Only perform expensive logging logic if respective logging level is enabled
  • v6.4.3 (6-August-2020): #284 Improved support for Calendar attachments created by gMail
  • v6.4.3 (6-August-2020): #283 Bugfix: Fix support for reading Calendar attachments with quoted-printable transfer-type
  • v6.4.2 (3-August-2020): #281 Bugfix: Fix support for reading Calendar attachments
  • v6.4.1 (26-July-2020): #252 Bugfix: Added missing support for S/MIME enveloped signing
  • v6.4.0 (19-July-2020): #268 Immediately resolve InputStreams when building emails, don't reuse
    • This primarily affects the builder api for S/MIME and DKIM signing / encryption.

v6.3.0 - v6.3.2 (11-July-2020 - 12-July-2020)

  • #271 Bugfix: Attachment (file)names with special characters should not be encoded
  • #248 Bugfix: MimeMessageHelper: use complete filename as resource name
  • #279 Allow extra Session properties configured through simplejavamail.properties
  • #277 Add API for using custom SSLSocketFactory

v6.2.0 (9-July-2020)

This release adds the following major new feature:

  • #260 Add support for dynamic datasource resolution (file/url/classpath) for embedded images in HTML body

v6.1.0 (5-July-2020)

  • #264 Switch from AssertionError to IllegalStateException
  • Bumped outlook-message-parser from 1.7.3 to 1.7.5
    • bugfix for parsing chinese unsent Outlook messages
    • bugfix Outlook attachments with special characters in the name
  • Bumped email-rfc2822-validator from 2.1.3 to 2.2.0
    • bugfix properly handle brackets in email addresses when allowed
  • Bumped log4j-core from 2.6.1 to 2.13.2

v6.0.2 - v6.0.5 (21-January-2020 - 13-June-2020)

  • #270 Bug: CLI module missing Jetbrains @Nullable annotation dependency needed in runtime
  • #262 Bug: Executor settings passed to the builder are ignored
  • #249 Bug: MimeMessageParser doesn't handle multiple attachments with the same name correctly
  • #245 Bug: JDK9+ Incorrect JPMS Automatic-Module-Name
  • #246 Bug: Sending async emails with and without the Batch module cause lingering threads

v6.0.0-rc1 - v6.0.1 (18-December-2019 - 24-January-2020)

After almost two years of development the next major release 6.0.0 is finally here! And what a doozy it is, with the following major new features:

The core library is now even smaller compared to the 5.x.x series going from 183kb to 134kb!

Here's the complete list of changes:

New features and enhancements

  • #183 To manage all the optional dependencies and related code, Simple Java Mail should be split up into modules
  • #156 Add CLI support
  • #214 Support more advanced batch processing use cases
  • #187 Simple Java Mail should have optional support for signed S/MIME attachments
  • #121 Introduce interfaces for validation and sending, so these steps can be customized
  • #144 Simple Java Mail should tailor the MimeMessage structure to specific needs
  • #138 Add support for Calendar events (iCalendar vEvent)
  • #235 Be able to fix the sent date for a new email
  • #232 Improve encoding of attachment file names
  • #222 Add config property support for trusting hosts and verifying server identity
  • #212 Authenticated proxy server started even if already running, raising exception
  • #207 Implement more comprehensive ThreadPoolExecutor and expose config options
  • #211 SpringSupport should expose the intermediate builder for customization
  • #193 Simple Java Mail should use default server ports when not provided by the user

Bugs solved

  • #242 Renamed log4j2.xml to log4j2_example.xml so it doesn't clash with project config
  • #241 EmailConverter.outlookMsgToEmail duplicates recipients
  • #239 List of Recipients not ordered as added (insertion order not maintained)
  • #236 Message ID should be mapped from Outlook messages as well
  • #210 Connection/session timeout properties not set when not sending in batch mode
  • #201 When parsing Outlook message, FROM address should default to a dummy address when missing
  • #200 When parsing Outlook message, attachment name doesn't fallback on filename if proper name is empty
  • #161 When reading (chinese) .msg files, HTML converted from RTF is completely garbled (encoding issue)
  • #159 Can not parse email with blank email address headers
  • #139 Multiple Bodyparts of same Content-Type not supported for text/html & text/plain within Multipart/mixed or Multipart/alternative
  • #151 Attachment's file extension overwritten by resource's invalid extension

Maintenance updates

  • #165 Move away from Findbugs (unofficial JSR-305) annotations
  • #164 The DKIM dependency has been updated to benefit from the newer Apache V2 license
  • #164 The DKIM dependency has been updated to benefit from the newer Apache V2 license
  • #184 Update JavaMail dependency to 1.6.2, adding support for UTF-8 charset
  • #186 Update JavaMail dependency to 1.6.2, adding support for authenticated HTTP web proxy
  • #146 Added OSGI manifest and switched to spotbugs

Included changes from outlook-message-parser

  • v6.0.1, v1.7.3: #27 When from name/address are not available (unsent emails), these fields are filled with binary garbage
  • v6.0.1, v1.7.2: #26 To email address is not handled properly when name is omitted
  • v6.0.0, v1.7.1: #25 NPE on ClientSubmitTime when original message has not been sent yet
  • v6.0.0, v1.7.1: #23 Bug: _nameid directory should not be parsed (and causing invalid HTML body)
  • v6.0.0, v1.7.0: #18 Upgrade Apache POI 3.9 -> 4.x (but managed back for Simple Java Mail due to incompatibility with Java 7)
  • v6.0.0, v1.6.0: #21 Multiple TO recipients are not handles properly
  • v6.0.0, v1.5.0: #20 CC and BCC recipients are not parsed properly
  • v6.0.0, v1.5.0: #19 Use real Outlook ContentId Attribute to resolve CID Attachments
  • v6.0.0, v1.4.1: #17 Fixed encoding error for UTF-8's Windows legacy name (cp)65001
  • v6.0.0, v1.4.0: #9 Replaced the RFC to HTML converter with a brand new RFC-compliant convert! (thanks to @fadeyev!)
  • v6.0.0, v1.3.0: #14 Dependency problem with Java9+, missing Jakarta Activation Framework
  • v6.0.0, v1.3.0: #13 HTML start tags with extra space not handled correctly
  • v6.0.0, v1.3.0: #11 SimpleRTF2HTMLConverter inserts too many
    tags
  • v6.0.0, v1.3.0: #10 Embedded images with DOS-like names are classified as attachments
  • v6.0.0, v1.3.0: #9 SimpleRTF2HTMLConverter removes some valid tags during conversion
  • v6.0.0, v1.2.1: Ignore non S/MIME related content types when extracting S/MIME metadata
  • v6.0.0, v1.2.1: Added toString and equals methods to the S/MIME data classes
  • v6.0.0, v1.1.21: Upgraded mediatype recognition based on file extension for incomplete attachments
  • v6.0.0, v1.1.21: Added / improved support for public S/MIME meta data
  • v6.0.0, v1.1.20: #7 Fix missing S/MIME header details that are needed to determine the type of S/MIME application
  • v6.0.0, v1.1.19: Log rtf compression error, but otherwise ignore it and keep going and extract what we can.

A big shout out to @dnault (runtime javadoc), @remkop (picocli) and @markenwerk (S/MIME and DKIM) for working with me to make the libraries work with JDK7+ and do what Simple Java Mail needed! Finally a great many thanks the numerous contributors on Simple Java Mail as well as outlook-message-parser - this release would not be there without you.

v5.5.0 - v5.5.1

  • v5.5.1 (20-October-2019): #230 Bugfix: Missing address value in address headers (ie. Return-Path) not handled properly, resulting in Exception
  • v5.5.0 (15-October-2019): #229 Bugfix: Timeouts not working for synchronous sendMail calls.

If you had connection properties configured for non-async send jobs, only now they will actually start to take effect.

v5.4.0 (28-August-2019)

  • #221 API bugfix: server identity verification should not be tied to host trusting
  • #226 Bug fix: Attachments with spaces in name are not handled properly
  • #218 Enhancement: make Email serializable
  • #227 Enhancement: Make parsing recipients from EML file more lenient
  • #225 Enhancement: Clarify dependency on Jakarta Activation: DataSources no longer work on Java 9+

v5.3.0 (16-August-2019)

  • #215 Bug: Current DKIM header canonicalization can lead to invalid DKIM

Note this release should have no impact, but nonetheless is a minor update so you can determine for yourself if this update would cause issues. The release changes DKIM header canonicalization from SIMPLE to RELAXED.

v5.2.1 (16-August-2019)

  • #219 Bug: MimeMessageParser rejects attachments with duplicate names

v5.2.0 (7-July-2019)

  • #213 Update from javax.mail:1.6.0 to jakarta.mail:1.6.3

Note that dependencies that switched as well have been updated as part of this change. This includes the optional DKIM library and the email validation library:

  • net.markenwerk:utils-mail-dkim (1.1.10 -> 1.2.0)
  • com.github.bbottema:emailaddress-rfc2822 (1.1.2 -> 2.1.3)

v5.1.1 - v5.1.7

  • v5.1.7 (22-May-2019): #171 Header validation tripping on known safe emails due to References header
  • v5.1.6 (27-April-2019): #204 A Concurrent exception when an async process starts when the previous connection pool didn't shutdown in time
  • v5.1.6 (27-April-2019): #204 B Exceptions in threads are now caught and logged and don't bubble up anymore. Note that more comprehensive exception handling will be available in 6.0.0 (#148).
  • v5.1.5 (24-April-2019): #202 Fixed ConcurrentModificationException when moving invalid embedded images as regular attachments
  • v5.1.4 (5-April-2019): #163 Fixed missing mimetype for attachments when parsing Outlook messages where mimeTag was not included
  • v5.1.3 (15-Januari-2019): Updated to newer rfc-validator version, which fixed a regression bug in that library
  • v5.1.2 (9-Januari-2019): #189 Bugfix for missing timeout config for .testConnection() function
  • v5.1.1 (22-December-2018): #190 Fix for transitive dependency clash because of emailaddress-rfc2822 library

v5.1.0 (21-November-2018)

  • #179 You can now test the connection to the SMTP server

v5.0.1 - v5.0.8

  • v5.0.8 (27-Oktober-2018): #178 Fix the annoying vulnerability Github report about spring-core
  • v5.0.7 (27-Oktober-2018): #175 Attachment names are not always parsed properly from MimeMessage
  • v5.0.6 (3-Oktober-2018): #167 Email addresses validated despite cleared validation validation criteria
  • v5.0.5 (3-Oktober-2018): #137 When replying to an email with HTML, the result body is empty
  • v5.0.4 (22-September-2018): #168 Properties aquired through ConfigLoader should be typed explicitly and converted if necessary
  • v5.0.3 (11-April-2018): #136 ServerConfig class should be public API
  • v5.0.2 (7-April-2018): #135 trustingAllHosts should be public on the Builder API
  • v5.0.2 (7-April-2018): #131 NamedDataSource should implement EncodingAware
  • v5.0.1 (10-March-2018): #130 java.lang.ClassNotFoundException: net.markenwerk.utils.mail.dkim.DkimMessage. Solves the issue of missing optional class DKIM even when not used

v5.0.0 (14-Februari-2018)

Also see the migration notes

New features

  • #116 You can now test the connection to the SMTP server
  • #115 Create mailers with a very robust MailerBuilder API, able to ignore defaults as well
  • #114 Create emails with a very robust EmailBuilder API, able to ignore defaults as well. Now includes support for InternetAddress. Also copy emails.
  • #107 You can now easily forward or reply to emails!

Security updates

  • #111 Protocol properties for SMTPS are now applied properly
  • #105 SMTP tries to upgrade to TLS while SMTP_TLS now enforces it and for both SMTP_TLS and SMTPS, mail.smtp.ssl.checkserveridentity is set to true

Maintenance updates

Complete Javadoc overhaul. Navigating the Javadoc should be much more consistent now (builder API being the single public source of truth).

  • #122 The email-rfc2822-validator library has been made a proper Maven dependency (not packaged along anymore)
  • #120 The DKIM library has been made an optional proper Maven dependency (not packaged along anymore)
  • #119 Switched optional Spring dependency version to property and now testing with 4.3.11.RELEASE
  • #113 Updated the underlying JavaMail to 1.6.0

Bugfixes

  • #110 Trusted hosts should be space-delimited
  • #109 Email headers should be allowed to be empty (now conversion errors can occur as well)
  • #103 Converting to MimeMessage results in an invalid Content-Disposition for attachments

v4.4.5 (2-September-2017)

  • #101 API backwards compatibility update, reinstate old addRecipient API as deprecated (sorry for removing it abruptly)

v4.4.4 (23-August-2017)

API usability release. This relase streamlined the recipient setters, breaking backwards compatibility (but straightforward to fix)

  • #95 Feature: Add support native API for setting Return-Receipt-To header
  • #93 Feature: Add support native API for setting Disposition-Notification-To header
  • #91 Feature: Add support for parsing preformatted email addresses that include both name and address
  • #94 Bugfix: A single EmailBuilder would build emails that all share the same collections for recipients, attachments and embedded images
  • #98 Bugfix: Subject and body content should be optional

v4.3.0 (12-August-2017)

Security and timeout release.

This version safeguards against SMTP injection attack from external values entering the library through Email instance. Also, this release introduces default/configurable timeouts for connecting, reading and writing when sending an email.

  • #89 Support multiple delimited recipient addresses sharing the same TO/CC/BCC name
  • #88 Safeguard subject property (and others) against SMTP CRLF injection attacks
  • #85 Apply configurable timeouts when sending emails
  • #83 Parse INLINE attachments without ID as regular attachments when converting (mostly applicable to Apple emails)

v4.2.3 (21-May-2017)

  • #79: Enhancement: define custom message ID on the Email object

  • #74: v4.2.3-java-6-release: A java6 version with limited capabilities: I've released a customised java6 release with a customised outlook-message-parser 1.1.16-java6-release. This is the last java6 release I will do, as it is simply too much manual labor to create a limited second edition.

    For this edition, I've removed the JDK7 Phaser completely which has the following consequences:

    • If authenticated proxy is used, the bridging proxy server will not be shut down automatically (and might not run the second time)
    • If mails are sent in async mode, the connection pool will not be shut down anymore by itself

    This means your server/application might not stop properly due to lingering processes. To be completely safe, only send emails in sync mode (used by default) and don't use authenticated proxy config.

v4.2.2 (10-May-2017)

  • #73: Patch: fix for sending emails in async mode, which makes sure the connection pool is always closed when the last known email has been sent. Without this fix, the connection pool keeps any parent process running (main thread or Tomcat for example) until a hard kill.

v4.2.1 (12-Feb-2017)

Patch: streamlined convenience methods for adding recipients.

v4.2.0 (12-Feb-2017)

Major feature: Using the EmailConverter you can now convert between Outlook .msg, EML, MimeMessage and Email!

  • #66: Feature: convert email to EML
  • #65: Feature: read outlook messages from .msg file
  • #64: Feature: Added support for logging-only mode that skips the actual sending of emails
  • #63: Feature: Already including in previous patch update: Spring support (read properties from Spring context)
  • #69: Enhancement: Expanded EmailBuilder API to inlude more options for setting (multiple) recipients
  • #70: Enhancement: Most public API now have defensive null-checks for required fields (Fail Fast support)
  • #68: Bugfix: Name should be required for embedded images (added safeguards)
  • #67: Bugfix: Error when name was omitted for attachment
  • minor: added methods on AttachmentResource that reads back the content as (encoded) String
  • other: internal testing is now done using Wiser SMTP test server for testing live sending emails

Note: Starting this release, there will always be a Java6 compatible release as well versioned: "x.y.z-java6-release"

v4.1.3 (28-Jan-2017)

  • #61: Feature: Add support for providing your own Properties object
  • #63: Feature: Spring support (read properties from Spring context)
  • #58: Bugfix: Add support for non-English attachment and embedded image names
  • #62: Bugfix: Empty properties loaded from config should be considered null

NOTE: ConfigLoader moved from /internal/util to /util

v4.1.2 (07-Nov-2016)

  • #52: bug fix for windows / linux disparity when checking socket status
  • #56: bug fix for IOException when signing dkim with a File reference

v4.1.1 (30-Jul-2016)

  • #50: bug fix for manual naming datasources

v4.1.0 (22-Jul-2016)

  • #48: Added programmatic support trusting hosts for SSL connections
  • #47: Honor given names, deduce extension from datasource name, and more robust support for parsing mimemessages

v4.0.0 (05-Jul-2016)

  • #41: added support for fast parallel batch processing
  • #42: added support for config files
  • #43: removed logging implementation dependencies from distribution and documented various sample configs
  • #39: simplified and renamed packages to reflect the domain name of the new website: simplejavamail.org
  • #38: added support for anonymous proxy
  • #38: added support for authenticated proxy

NOTE: All packages have been renamed to "org.simplejavamail.(..)" NOTE: Switched to Java 7

v3.1.1 (11-May-2016)

Major feature: DKIM support!

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

NOTE: this is the last release still using Java 6. Next release will be using Java 7. /edit: starting with 4.2.0 every release will now have a "x.y.z-java6-release" release as well

v3.0.2 (07-May-2016)

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

v3.0.1 (29-Feb-2016)

  • #31: Fixed EmailAddressCriteria.DEFAULT and clarified Javadoc

v3.0.0 (26-Feb-2016)

  • #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 (19-Jan-2016)

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

v2.5 (19-Jan-2016)

  • #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 (12-Aug-2015)

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

v2.3 (21-Jul-2015)

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

v2.2 (09-May-2015)

  • #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 here for an example)

v2.1 (09-Aug-2012)

  • 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 (20-Aug-2011)

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

v1.9.1 (08-Aug-2011)

  • updated for Maven support

v1.9 (6-Aug-2011)

  • 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 (22-Mar-2011)

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

v1.4 (15-Jan-2011)

vX.X (26-Apr-2009)

  • Initial upload to Google Code.
Comments
  • Send multiple emails per session connection

    Send multiple emails per session connection

    Hi! This is more of a question rather than an issue.

    I'm working on an implementation that has to send many emails using one and the same SMTP server. I saw that async sending is already supported which is pretty cool! However, I was looking for a way to send many emails synchronously over an already established TCP connection.

    Browsing the MailSender code I stumbled on this part. I think this opens a new connection for each email, right? Does it make sense to improve this, so that it reuses the transport/session to send several messages synchronously?

    duplicate enhancement Priority-Low 
    opened by petarov 36
  • Add support for parsing preformatted email addresses that include both name and address

    Add support for parsing preformatted email addresses that include both name and address

    I recently became acquainted with SimpleJavaMail. I've been testing it for a few days, and so far, I like it very much. Thank you very much for making it, and sharing it with us!

    On your website, you asked for suggestions for how it could be improved. I have a few "wishlist" items for it. I'll put them in separate tickets so you can evaluate and track them individually.


    You currently have the ability to add multiple recipients with:

    email.addRecipients("[email protected], [email protected]", RecipientType.TO);
    

    It'd be very much appreciated if you would extend its capabilities to accept entries such as:

    email.addRecipients("\"John Smith\" <[email protected]>, \"Jane Doe\" <[email protected]>", RecipientType.TO);
    
    enhancement Priority-Low 
    opened by dormitionskete 25
  • Implement more comprehensive ThreadPoolExecutor and expose config options

    Implement more comprehensive ThreadPoolExecutor and expose config options

    This is the new path for the discussions fragmented over #204, #205 and #206. Paging Mr. @amanteaux.

    Let's continue our threading discussion here? I really appreciate your input and you have already brought up some interesting points. And also, because of you I did some research and now know (again?) about some cool new things like BlockingQueue, SynchronousQueue and TransferQueue :punch:

    I backported the changes to "207-configurable-threadpoolexecutor" branched from develop, so we can implement this for 6.0.0.

    enhancement Priority-Low 
    opened by bbottema 16
  • Class not being able to be found when using Java 10

    Class not being able to be found when using Java 10

    I tried sending an email and when I tried to run the code it threw a ClassNotFoundExpection. I have everything imported via Maven my pom.xml which looks like the following:

        <groupId>me.willis.myplugin</groupId>
        <artifactId>MyPlugin</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <repositories>
            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
            </repository>
        </repositories>
    
    
        <dependencies>
            <!--Spigot API-->
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.12.2-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
            <!--Bukkit API-->
            <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.12.2-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.simplejavamail</groupId>
                <artifactId>simple-java-mail</artifactId>
                <version>5.0.3</version>
            </dependency>
            <!--Google Authentication-->
            <dependency>
                <groupId>com.warrenstrange</groupId>
                <artifactId>googleauth</artifactId>
                <version>1.1.2</version>
            </dependency>
        </dependencies>
    
    </project>
    

    The error that showed up was the following: java.lang.NoClassDefFoundError: org/simplejavamail/email/EmailBuilder

    The code I was using:

            Email email = EmailBuilder.startingBlank()
                    .to("[email protected]")
                    .withSubject("test")
                    .withPlainText("hello")
                    .buildEmail();
    
            Mailer mailer = MailerBuilder
                    .withSMTPServer("smtp.gmail.com", 587, "[email protected]", "MyPassword")
                    .withTransportStrategy(TransportStrategy.SMTP_TLS)
                    .withSessionTimeout(10 * 1000)
                    .clearEmailAddressCriteria()
                    .withDebugLogging(true)
                    .buildMailer();
    
            mailer.sendMail(email);
        }
    
    bug Priority-Low 
    opened by Willim7 16
  • JDK9+ Incorrect JPMS Automatic-Module-Name = simple-java-mail

    JDK9+ Incorrect JPMS Automatic-Module-Name = simple-java-mail

    Jpms module name Automatic-Module-Name: simple-java-mail in MANIFEST.MF is not valid, change it please to simple.java.mail or else that is valid. thx!

    bug Priority-High 
    opened by colesico 14
  • Handle embedded (INLINE) resources as attachments if the cid identifier doesn't occur in the HTML body

    Handle embedded (INLINE) resources as attachments if the cid identifier doesn't occur in the HTML body

    Hi, Benny Bottema

    I have a problem, the details are as follows。

    1. Scene description

    Here is my hello.eml file which include a attachment and a embedded image exported by client application Foxmail. Open with outlook screenshot below:

    a

    2. Parse eml but can't get any information

    Email oldEmail = EmailConverter.emlToEmail("/Users/rick/jkxyx205/tmp/hello.eml");
    
    333 bug Priority-Low 
    opened by jkxyx205 14
  • Simple Java Mail should include CLI support

    Simple Java Mail should include CLI support

    I'd like to download the jar, put a properties file on the classpath, and run java -jar simple-java-mail.jar. If you made the API so simple, why do I need to go through the exercise of setting up a project for a single line of code?

    enhancement Priority-Low 
    opened by asarkar 13
  • java.lang.ClassNotFoundException: net.markenwerk.utils.mail.dkim.DkimMessage

    java.lang.ClassNotFoundException: net.markenwerk.utils.mail.dkim.DkimMessage

    Getting this error:

    java.lang.ClassNotFoundException: net.markenwerk.utils.mail.dkim.DkimMessage
     	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0-8u162]
     	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0-8u162]
     	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[mikvah-1.0.5.jar:1.0.5]
     	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0-8u162]
    	at org.simplejavamail.mailer.internal.mailsender.MailSender.sendMailClosure(MailSender.java:240) ~[simple-java-mail-5.0.0.jar!/:na]
     	at org.simplejavamail.mailer.internal.mailsender.MailSender.send(MailSender.java:211) ~[simple-java-mail-5.0.0.jar!/:na]
     	at org.simplejavamail.mailer.Mailer.sendMail(Mailer.java:239) ~[simple-java-mail-5.0.0.jar!/:na]
     	at org.simplejavamail.mailer.Mailer.sendMail(Mailer.java:230) ~[simple-java-mail-5.0.0.jar!/:na]
     	at com.myservice.EmailService.sendEmail(EmailService.java:70) ~[classes!/:1.0.5]
    
    bug Priority-Medium 
    opened by adamzr 13
  • Feature: Expand email builder API to support Content-Description on attachments

    Feature: Expand email builder API to support Content-Description on attachments

    Hello,

    I want to send an email with an attachment. The attachment should contain as meta information a Content-Description. But my Content-Description header is ignored:

    MimeMessage: Date: Wed, 13 Jul 2022 12:40:46 +0200 (CEST) From: xxxx Reply-To: xxxx To: "xxxx" Message-ID: 747447859.1.1657708846687@xxxxx Subject: TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_0_1827369718.1657708846523" X-KIM-Dienstkennung: eAU;Lieferung;V1.0 Disposition-Notification-To: xxxxxx Return-Receipt-To: xxxxxx

    ------=_Part_0_1827369718.1657708846523 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit

    eAU ------=_Part_0_1827369718.1657708846523 Content-Type: application/octet-stream; filename=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s; name=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s Content-ID: <TEAU0_eb24af60-51f3-45e7-ac7b-2abcc7cdba10.p7s>

    Here at the end for 'eAU'-section the 'Content-Description'-element should be added.

    My code:

    List<AttachmentResource> attachmentResources = new ArrayList<>();
    
    InternetHeaders headers = new InternetHeaders();
            headers.addHeader("Content-Description", storno ? "eAUStorno" : "eAU");
            headers.addHeader("Content-Type", MediaType.APPLICATION_OCTET_STREAM_VALUE);
    
    MimeBodyPart mimeBodyPart = new MimeBodyPart(headers, xml, xml.length);
    
    attachmentResources.add(new AttachmentResource(generateFilename(uuid, storno), mimeBodyPart.getDataHandler().getDataSource()));
    
    Email email = EmailBuilder.startingBlank()
                        .withHeader(KimHeader.getDienstKennungHeaderName(), kimDienst.getEmailDienstKennungHeader())
                        .withReturnReceiptTo(from)
                        .withDispositionNotificationTo(from)
                        .withAttachments(attachmentResources)
                        .from(from)
                        .to(toName, toAdress)
                        .withSubject(subject)
                        .withPlainText(emailTextInhalt)
                        .buildEmail();
    
    mailer.sendMail(email);
    

    The 'Content-Type'-header is being processed, but the 'Content-Description' is ignored. Version is 6.7.6

    Any ideas how to solve my problem? Thanks a lot for help!

    enhancement Priority-Low 
    opened by CrisVnait 12
  • ver 7.0.0 jakarta.mail.Session breaking changes on application server

    ver 7.0.0 jakarta.mail.Session breaking changes on application server

    • On application server(glassfish, payara, ...), JavaMail Sessions is:

    a JavaMail session resource represents a mail session in the JavaMail API.

    • with this change, you broke backward compatibility, it should still have usingSession which uses javax.mail.Session
    • it is very common to use @Resource for javax.mail.Session
    • maybe would be better to have extra usingJakartaSession for jakarta.mail.Session
    invalid 
    opened by sysmat 11
  • Failed to send mails with calendar entry

    Failed to send mails with calendar entry

    Hi there,

    I am experiencing issues when sending mails with a calendar entry attached. The stack trace i get is shown below. Mails without calendar attachments can be sent without any errors. Does anybody has an idea what might be the cause of this issue? I am using the newest 6.5.2 version of the dependency.

    2021-04-29 10:14:32,922 ERROR [Simple Java Mail async mail sender, executor 1 / thread 20] de.xxx.xxx.xxx.Mailer : Failed to send mail with subject 'xxxxxxxxxxxxxxxxxx'! org.simplejavamail.mailer.internal.MailerException: Third party error at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:87) at org.simplejavamail.mailer.internal.AbstractProxyServerSyncingClosure.run(AbstractProxyServerSyncingClosure.java:56) at org.simplejavamail.internal.util.concurrent.AsyncOperationHelper$1.run(AsyncOperationHelper.java:75) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar; charset="UTF-8"; method="REQUEST" at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1350) at org.simplejavamail.mailer.internal.util.TransportRunner$1.run(TransportRunner.java:52) at org.simplejavamail.mailer.internal.util.TransportRunner.sendUsingConnectionPool(TransportRunner.java:86) at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:72) at org.simplejavamail.mailer.internal.util.TransportRunner.sendMessage(TransportRunner.java:48) at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:78) ... 7 more Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar; charset="UTF-8"; method="REQUEST" at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:885) at javax.activation.DataHandler.writeTo(DataHandler.java:316) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1670) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:972) at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:537) at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:66) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:883) at javax.activation.DataHandler.writeTo(DataHandler.java:316) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1670) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1880) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300) ... 12 more

    invalid 
    opened by jbreitung 11
Releases(7.6.0)
Masterful Machinery is a mod about creating customisable and complex multiblocks machines.

Masterful Machinery Masterful Machinery is a mod about creating customisable and complex multiblocks machines. Everything in the mod is customisable w

null 23 Nov 12, 2022
A little container and simulator for Complex Adaptive Systems (CAS)

Complex Adaptive Systems Description This is a little container and simulator for Complex Adaptive Systems (CAS). CAS are typically living Complex Sys

Pietro Dondi 1 Feb 13, 2022
Simple way of causing a bsod using the native api implemented into a 1.12.2 Forge mod

Simple-BSOD-Mod Simple way of causing a bsod using the native api implemented into a 1.12.2 Forge mod. Dowload It HERE To make your own you can go to

INZO_Technologies 5 Dec 28, 2022
Simple, server side api for drawing on maps with runtime only state and no id collisions

Simple, server side api for drawing on maps with runtime only state and no id collisions! It can be used in non-main/server threads for better performance/more fps.

null 7 Sep 2, 2022
API gateway for REST and SOAP written in Java.

Membrane Service Proxy Reverse HTTP proxy (framework) written in Java, that can be used as an API gateway as a security proxy for HTTP based integrati

predic8 GmbH 389 Dec 31, 2022
A high level API to express vectorized operations in Java

vector-handle A high level API to express vectorized operations on primitive arrays in Java allowing to specify the vectorized operations as a simple

Rémi Forax 25 Oct 5, 2022
This service checks the Co-WIN public API at a specific interval and send update to users specified telegram bot.

COVID VACCINE TELEGRAM BOT USING SPRING BOOT This application is a covid vaccine slot notifier via telegram bot. This application uses public CO-WIN A

Hardeek Sharma 6 Oct 4, 2022
JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface that is bound to the external C library using method names.

JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface t

null 28 Dec 30, 2022
Leveraging Java 8, create an API with a multi-tier user system.

Project 0 Description Leveraging Java 8, create an API with a multi-tier user system. You may choose the actual use case for your application as long

null 1 Jan 9, 2022
SpringBoot Micro Services, Discovery Server, Discovery Client, API-Gateway

SpringBoot Micro Services, Discovery Server, Discovery Client, API-Gateway

null 2 Jan 26, 2022
This repository holds the source code for TML (Tecknix Mod Loader)'s API.

This repository contains the modding API not the MDK (Mod Development Kit). This repository will not give you the ability to mod Tecknix Client but you can contribute to the repository if you have events you would like to add.

Tecknix Client 6 Aug 1, 2022
The project was created using the API of the Spotify application.

Spotify API The project was created using the API of the Spotify application.

Atakan Koçyiğit 3 Jan 27, 2022
This API provides functionalities to lookup and manage user accounts

This API provides functionalities to lookup and manage user accounts. Any human or computer system that will interact with any of the API's requires being authenticated as a user. The API allows for common functionalities such as creating a new user account, resetting passwords and generating JWT tokens.

Narek Naltakyan 1 Jan 22, 2022
A Fast, Secure, Ready to use, Highly customizable email verifier API

Email verification API What is this? A Fast, Secure, Ready to use, Highly customizable email verifier API. How to use Clone the project git clone http

Amir 3 Oct 4, 2022
A JavaCard applet for setting the global PIN (0x11) on a card using GlobalPlatform API

A JavaCard applet for setting the global PIN (0x11) on a card using GlobalPlatform API

Chris Hicks 2 Mar 4, 2022
An open-source component of TabLight project "Base-API"

DataAddons is a library (or framework?) created for Minecraft providing comfortable abstractions making additions over already existing data, generally, it is anti-pattern ans YOU SHOULDN'T USE IT in normal programms.

XXR 3 Mar 8, 2022
Backend for Saunah Management App provides a REST-API for the Saunah management app

?? ?? Saunah Backend Backend for Saunah Management App. This application provides a REST-API for the Saunah management app. ????‍?? Technology Stack T

null 2 Jun 13, 2022
Public API for all of ID2R's projects

Public API for all of ID2R's projects. This API contains some useful utilities and tools that will help ID2R to deliver high quality code. originally developed by Invvk.

ID2R Studios 3 Sep 8, 2022
A Parser That parses OpenAPI definitions in JSON or YAML format and Generates Pact files That contain HTTP request/response interactions by parsing Given Open API specifications

This is a Parser That parses OpenAPI definitions in JSON or YAML format and Generates Pact files That contain HTTP request/response interactions by parsing Given Open API specifications.

dev-rgupta 2 Mar 19, 2022