bbottema/simple-java-mail

Simple Java Mail should tailor the MimeMessage structure to specific needs

bbottema opened this issue · 3 comments

Currently Simple Java Mail uses standardized structure that can handle attachments, embedded images, email forwards, text, HTML and iCalendars:

 - mixed
 	- related
 		- alternative
 			- mail tekst
 			- mail html tekst
 			- iCalendar tekst
 		- embedded images
 	- forwarded message
 	- attachments

However, this means the structure is not always fully populated, for example when there are no attachments the Multipart "mixed" contains only the actual content. Or when there are no embedded images the Multipart "related" only contains the text or HTML. This is fine, except that some email clients are unable to deal with this. For example, the mere presence of a Multipart "mixed" causes Outlook 365 to always show an attachment icon in the mail list, even though there are no attachments.

To solve this, Simple Java Mail should be more flexible in the Multipart structure it uses depending on actual use. This means the resulting structure will always be a subset of the current standardized structure unless all email fields are being used (necessitating "related", "mixed" and "alternative" Multiparts).

Example of just plain text:

- mail tekst

Example of plain and HTML text:

 - alternative
 	- mail tekst
 	- mail html tekst

All possible combinations will get there own structure this way. Once implemented, the documentation will list all possible structures.

Solves #133 (thanks for the report @SoltauFintel).

Implementation finished. Every email combination will now result in a minimal multipart structure as needed.

When released, the documentation now contains a message structure browser that shows what structure is used for what combination of email features. Look for it in the RFC Compliance page.

Also, there is a new demo app class that demonstrates all the possible mixed, related, alternative multipart combinations.

Released in 6.0.0-rc1.

6.0.0 has released as well, finally.