Fork me on GitHub
Simple Java Mail
Simple API, Complex Emails

Simple Java Mail is RFC compliant

§

Why RFC compliancy matters

One thing that plagues other libraries is the lack of true RFC compliance. Though fine for simple mails, this becomes a testing nightmare if for example you need to send an HTML mail (with text fall-back?) using both attachment and embedded images.

The problem becomes evident when testing the mail in various e-mail clients (desktop, web based, mobile) by the fact that the e-mails will be displayed completely inconsistent and sporadic. Symptoms include:

  • not seeing embedded images, or
  • icon for attachment is shown while there are no attachments, or
  • embedded images are displayed as attachments,
  • not seeing the HTML version if a text version is present,
  • not seeing the text version if a HTML version is present,
  • not seeing attachments,
  • attachments aren't handled correctly according to mime type, or
  • header information is missing or incorrect so you can't see how long a download will take,
  • from/to addresses being malformed (like missing the <name> part in <name> address@domain.com)

The research has been done and Simple Java Mail is RFC compliant for simple to complex mails. Furthermore, it has been tested in a range of known clients such as Outlook, Thunderbird, Gmail, Hotmail, Android, iPhone etc.

§

How is Simple Java Mail RFC compliant?

Simple Java Mail is in two ways RFC (MIME) compliant:

  1. It is built on top of Jakarta Mail, which is java's standard email library used by all other mail libraries. Jakarta Mail itself implements various RFC's (including those for SMTP, POP3, IMAP etc).
  2. What makes Simple Java Mail unique is that it combines all the RFC's implemented by Jakarta Mail in the correct way that works in all email clients. Where all other popular mailing libraries let you figure out the low level details of this through MimeMessage, BodyPart, MimeMultipart etc. as described in the individual RFC's, Simple Java Mail takes care of this for you and hides all this behind a super clean API. Now you can focus on the content of the email, rather than email's technical low level structure.
§

Explore the multipart structures used by Simple Java Mail

Simple Java Mail takes the perfect-fit approach and uses the exact mime message structural fit that matches the use case. Play around with the various possibilities below:

Configure your email:

Structure used for email: