ram-sharma-6453 / email-mime-parser

A mime4j based simplified email mime parser for java
Apache License 2.0
46 stars 16 forks source link

Making inlining of attachments in html optional #4

Closed DaemonicTrolley closed 6 years ago

DaemonicTrolley commented 6 years ago

This library seems to do everything I'm looking for except that it insists on putting inline attachments back inline in the html body (they are transmitted as separate MIME parts in the email but by the time I get an Email object from this library they are back inside the html body). I need to keep them separate. It would be very helpful if a parameter could be introduced to allow this behaviour to be switched off.

ram-sharma-6453 commented 6 years ago

This library seems to do everything I'm looking for except that it insists on putting inline attachments back inline in the html body

The inline attachments are meant to be displayed inside the email main body, that's why the library behaves so (RFC : 2183).

(they are transmitted as separate MIME parts in the email but by the time I get an Email object from this library they are back inside the html body).

The email stream is defined like that way only , Email needs to be constructed back from raw mime parts to be displayed at the end email client.

I need to keep them separate. It would be very helpful if a parameter could be introduced to allow this behaviour to be switched off.

I won't be able to introduce a separate parameter to switch off the default right behavior of the library, that would lead to lot of confusion for other users.

For your special case I would suggest you to fork/compile the main branch locally for your use and comment the following method call in 'Email.java' class : (line no. 238) replaceInlineImageAttachmentsInHtmlBody();

You will get all the attachments the way you want via the following method as usual : email.getAttachments()

ram-sharma-6453 commented 6 years ago

Closed