Skip to content

Issue with attachments sent to certain email providers (targets) #231

@staniko

Description

@staniko

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions