Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the use of 'filename' and 'name' as additional parameters within the content-type header optional #541

Open
sebastian-schmitt opened this issue Aug 26, 2024 · 3 comments

Comments

@sebastian-schmitt
Copy link

sebastian-schmitt commented Aug 26, 2024

When adding an attachment, the Content-Type header of the corresponding mime-part gets the 'filename' and 'name' of the attachment appended as additional parameters (see link below).

Our remote party is pretty picky about this header and wants us to remove these extra parameters from this header.
I could not find a good way to do that - this is why I wish I could opt-out from this behavior:

ParameterList pl = new ParameterList();
pl.set("filename", fileName);
pl.set("name", fileName);
attachmentPart.setHeader("Content-Type", contentType + pl);

@sebastian-schmitt
Copy link
Author

sebastian-schmitt commented Aug 26, 2024

alternatively I was looking for some hook to modify the intermediate MimeMessage at some point between being built and being sent. (maybe the CustomMailer?)

@sebastian-schmitt
Copy link
Author

after digging deeper into our problem, I found that only one of those parameters (namely the "filename") causes the problems at the remote side:
They expect the "name" parameter within the Content-Type header and the "filename" parameter within the Content-Disposition header.
So basically, it's the line 265 only (see above) which I try to disable.
(for now we forked the repository to do this manipulation by hand, but it would be great to have some kind of tool to access and modify the resulting MimeMessage in more detail)

@bbottema
Copy link
Owner

I'm trying to remember why I left it in the Content-Type to begin with. Legacy? Backwards compatibility? I'm trying to figure out what I might break by simply removing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@sebastian-schmitt @bbottema and others