bbottema/simple-java-mail

Converting to MimeMessage results in an invalid Content-Disposition for attachments

fauvetg opened this issue · 2 comments

Hello,

When building a MimeMessage from an Email with the class MimeMessageHelper, the resulting MimeMessage has a wrong Content-Disposition header for attachments. The size is attribute is not correct :

------=_Part_32_1708476334.1507045824508
Content-Type: application/pdf; filename=XXX.pdf; name=XXX
Content-Transfer-Encoding: base64
Content-Disposition: attachment; size=0; filename=XXX.pdf
Content-ID: <ATT_TE91266914>

...

Some mailers (reproduced on and Apple mailer and Horde) cannot open those attachments.

I don't have a fix to provide, but I think the bug is in method MimeMessageHelper#getBodyPartFromDatasource.

NB : we use version 4.2.1

I'll look into it. Thanks for the report!

Released as 5.0.0.rc1-SNAPSHOT. Add OSS' snapshots repo to find it in Maven.