You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The org.simplejavamail.email.internal.EmailPopulatingBuilderImpl#withAttachment() methods contain call to MiscUtil.encodeText(text) which encode attachment names. If I want later to query attachments on my Email object, I'll see encoded messages, which are different from what was populated. It's not very convenient, I would expect this encoding to happen at a later stage, just before sending the email, keeping Java model clean and not overriding values I populated it with initially.
When parsing an msg file it also creates a problem, since resulting Email object won't have original file name at all - I have to decode it manually.
Morever, MimeUtility.encodeText() and MimeUtility.decodeText() do not work reliably on all platforms. I couldn't get to the bottom of it, but on my machine MimeUtility.encodeText(text) produces output which can't be parsed by MimeUtility.decodeText(text), although MimeUtility.encodeText(text, "UTF-8", "B") works well in all cases.
Activity
bbottema commentedon Oct 21, 2019
Good points all around. I take it you're not on a released version, since you're quoting 6.0.0 develop code?
#232: move mime encoding from email building phase to email sending p…
#232: move mime encoding from email building phase to email sending p…
bbottema commentedon Oct 21, 2019
Implemented enhancement for 6.0.0.
[-]Encoding of attachment file names is done in the wrong place[/-][+]Improve encoding of attachment file names[/+]bbottema commentedon Dec 18, 2019
Released in 6.0.0-rc1.
bbottema commentedon Jan 24, 2020
6.0.0 has released as well, finally.
bbottema commentedon Jul 12, 2020
FYI, as per #271 and https://javaee.github.io/javamail/FAQ#encodefilename, I'm going to turn off encoding of filenames, but I will make sure the value it is tested for injection attacks.