-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Improve encoding of attachment file names #232
Labels
Milestone
Comments
Good points all around. I take it you're not on a released version, since you're quoting 6.0.0 develop code? |
bbottema
added a commit
that referenced
this issue
Oct 21, 2019
…hase, keeping the Email model clean. Also improved mime text encoding to use cross-platform base64 encoding
bbottema
added a commit
that referenced
this issue
Oct 21, 2019
…hase, keeping the Email model clean. Also improved mime text encoding to use cross-platform base64 encoding
Implemented enhancement for 6.0.0. |
bbottema
changed the title
Encoding of attachment file names is done in the wrong place
Improve encoding of attachment file names
Dec 17, 2019
Released in 6.0.0-rc1. |
6.0.0 has released as well, finally. |
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
org.simplejavamail.email.internal.EmailPopulatingBuilderImpl#withAttachment()
methods contain call toMiscUtil.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()
andMimeUtility.decodeText()
do not work reliably on all platforms. I couldn't get to the bottom of it, but on my machineMimeUtility.encodeText(text)
produces output which can't be parsed byMimeUtility.decodeText(text)
, althoughMimeUtility.encodeText(text, "UTF-8", "B")
works well in all cases.The text was updated successfully, but these errors were encountered: