-
-
Notifications
You must be signed in to change notification settings - Fork 275
Description
We discovered, that for certain email providers not all attachments are working, when they contain special characters or blanks e.g. "Köln Ausflugsziel.pdf". Gmail can handle this, but incamail.ch for example not.
We solved this by patching the MimeMessageHelper.java with following line (escaping the fileName and taking the filename variable also for the name attribute, because if non US-ASCII chars are used in attachment name, the attachment extension is changed to .dat. This happens maybe because Simple Java Mail always uses application/octet-stream as Content-Type of attachments instead of application/pdf or image/png, etc.
MimeMessageHelper.java:240:
attachmentPart.setHeader("Content-Type", contentType + "; filename=\"" + fileName + "\"; name=\"" + fileName + "\"");
Would be great if someone can crosscheck this and we add it to the main code. For us it works now with all kinds of attachments to various providers.
Best regards
Stan