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

Bug encoding in setFrom() #27

Closed
devpad opened this issue Feb 14, 2015 · 6 comments
Closed

Bug encoding in setFrom() #27

devpad opened this issue Feb 14, 2015 · 6 comments

Comments

@devpad
Copy link

devpad commented Feb 14, 2015

Mistake in a name of the sender when using cyrillics

Email email = new Email();
email.setFrom("Тест <test@example.com>");

Output:
From: ""5AB" <test@example.com>

Should be so:
From: =?UTF-8?B?0KLQtdGB0YI=?= <test@example.com>

@ggrossetie
Copy link
Member

Hello @devpad, can I ask you where the output came from ? I guess it's from the mock implementation but I want to be sure.

Thanks,
Guillaume.

@devpad
Copy link
Author

devpad commented Feb 15, 2015

Hello @Mogztter, yes, the original letter in Gmail, shows the same output.

@ggrossetie
Copy link
Member

Ok I will do some testing on this issue, thanks.

@ggrossetie
Copy link
Member

@devpad is your source code encoded in UTF-8 ?

@devpad
Copy link
Author

devpad commented Feb 15, 2015

@Mogztter, yes, source codes in UTF-8. The setFrom() method doesn't code a user name in UTF-8 whereas in the addTo() method everything works correctly.

Example:

Email email = new Email();
email.setSubject("Example");
email.setFrom("Кириллица <login@gmail.com>");
email.addTo("Кириллица <login2@gmail.com>");
...
MailerPlugin.send(email);

Output in gmail:

...
Date: Sun, 15 Feb 2015 16:38:48 +0300 (MSK)
From: "�8@8;;8F0" <login@gmail.com>
To: =?UTF-8?B?0JrQuNGA0LjQu9C70LjRhtCw?= <login2@gmail.com>
Message-ID: <.....>
Subject: Example
MIME-Version: 1.0
...

@ggrossetie
Copy link
Member

Strange... the play-mailer extension is based on Apache commons email and the code is similar between setFrom and addTo:

You are using the plugin in Java but we simply convert the Java object Email to the Scala object Email : https://github.com/playframework/play-mailer/blob/master/src/main/scala/play/api/libs/mailer/MailerPlugin.scala#L114

Can you try to force the charset with setCharset (I don't see why this should fix this issue but who knows 😄
https://github.com/playframework/play-mailer/blob/master/src/main/scala/play/libs/mailer/Email.java#L136

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

No branches or pull requests

2 participants