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

MimeMailHelper mail address header fields are not encoded [SPR-6530] #11196

Closed
spring-projects-issues opened this issue Dec 7, 2009 · 3 comments
Closed

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Dec 7, 2009

Benjamin Peter opened SPR-6530 and commented

It seems like the MimeMailHelper does not encode mail address header fields.

In my expectation adresses like ---"Hans Müller" hisname@hishost.com--- should be encoded to something like ---=?ISO-8859-1?Q?"Hans=FXM=FXller?= histname@hishost.com--- if the MimeMailHelper is used to ensure a valid email.

I might also be wrong but please correct me.

As I see it according to RFC 2045 the name part of the address is "phrase" and in RFC 2047 can also be an encoded-word. "phrase = 1*( encoded-word / word )".

I added a small example program to demonstrate the behaviour. Subject and Text are encoded but From: and To: are not.


Affects: 3.0 M3

Attachments:

Referenced from: commits fd3a39d

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2009

Benjamin Peter commented

javac -classpath .:$HOME/.m2/repository/javax/mail/mail/1.4.1/mail-1.4.1.jar:$HOME/.m2/repository/org/springframework/spring-context-support/3.0.0.M3/spring-context-support-3.0.0.M3.jar:$HOME/.m2/repository/org/springframework/spring-core/3.0.0.M3/spring-core-3.0.0.M3.jar:$HOME/.m2/repository/org/springframework/spring-beans/3.0.0.M3/spring-beans-3.0.0.M3.jar MailEncoding.java

java -classpath .:$HOME/.m2/repository/javax/mail/mail/1.4.1/mail-1.4.1.jar:$HOME/.m2/repository/org/springframework/spring-context-support/3.0.0.M3/spring-context-support-3.0.0.M3.jar:$HOME/.m2/repository/org/springframework/spring-core/3.0.0.M3/spring-core-3.0.0.M3.jar:$HOME/.m2/repository/org/springframework/spring-beans/3.0.0.M3/spring-beans-3.0.0.M3.jar MailEncoding

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 11, 2010

Juergen Hoeller commented

Good point - we should encode all such String address value as well, even if the JavaMail InternetAddress class doesn't offer a straightforward constructor for it: We rather need to call InternetAddress.parse and construct an encoded InternetAddress instance ourselves now.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 16, 2010

Benjamin Peter commented

Thank you! :)

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

Successfully merging a pull request may close this issue.

None yet
2 participants