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

Email Recovery's content can't display Chinese charactors #269

Closed
smartmadio opened this issue Nov 16, 2015 · 22 comments
Closed

Email Recovery's content can't display Chinese charactors #269

smartmadio opened this issue Nov 16, 2015 · 22 comments
Assignees
Milestone

Comments

@smartmadio
Copy link

Hello,I enabled email recovery and wrote 'mailText' in Chinese Today.When I tested it ,I found all Chinese charactors in the the password recovery mail content displayed as ??? but the mail title can display Chinese charactors correctly.

(I've tried to transform coding format of config.yml into UTF-8 or GBK but it still don't work.)

Current Minecraft-Spigot version: 1.8.8
Current authme version: AuthMeReloaded-Dev #339

@Xephi
Copy link
Contributor

Xephi commented Nov 16, 2015

Can you please try to add '-Dfile.encoding=UTF-8' into server line command starting and tell me if that work ?

@smartmadio
Copy link
Author

@Xephi I've added '-Dfile.encoding=UTF-8' into server line command starting,but it didn't work too.

@DNx5
Copy link
Contributor

DNx5 commented Nov 27, 2015

we should move it into a file.

@sgdc3
Copy link
Member

sgdc3 commented Nov 27, 2015

What do you mean @DNx5 ?

@DNx5
Copy link
Contributor

DNx5 commented Nov 28, 2015

mailText value

@Xephi
Copy link
Contributor

Xephi commented Dec 4, 2015

Can you please try latest dev build and tell me if the email.html works ?

Xephi

@smartmadio
Copy link
Author

Testing on it :-)

@smartmadio
Copy link
Author

[Craft Scheduler Thread - 3/WARN]: org.apache.commons.mail.EmailException: Invalid message supplied
at org.apache.commons.mail.HtmlEmail.setHtmlMsg(HtmlEmail.java:151)
at fr.xephi.authme.SendMailSSL$1.run(SendMailSSL.java:84)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Authme version:#472

@smartmadio
Copy link
Author

I‘ve put email.html in authme folder,and it can start up now.But,still,there's ??????????????? instead of Chinese charactors in the email I received.(Tested on adding '-Dfile.encoding=UTF-8' or not adding '-Dfile.encoding=UTF-8' and changing email.htm to 'UTF-8 no bom' or GBK .

Spigot1.8.8 #186

@sgdc3 sgdc3 added this to the 5.2 Relase milestone Dec 17, 2015
@smartmadio
Copy link
Author

Besides,image,playername,generatedpass,servername in the email.html won't work.

@sgdc3
Copy link
Member

sgdc3 commented Dec 18, 2015

@Xephi

@Xephi
Copy link
Contributor

Xephi commented Dec 23, 2015

Fixed, i think :')

@smartmadio
Copy link
Author

Got this error,seems it still couldn't creat email.html correctly(Auhtme #186):

[09:20:26 WARN]: org.apache.commons.mail.EmailException: Invalid message supplied
        at org.apache.commons.mail.HtmlEmail.setHtmlMsg(HtmlEmail.java:151)
        at fr.xephi.authme.SendMailSSL$1.run(SendMailSSL.java:84)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

@smartmadio
Copy link
Author

I didn't know the correct format of email.html and authme also didn't create this file.
I'll try to write an email.html myself,put it into authme folder and have another test.

@smartmadio
Copy link
Author

This's what I've written in email.html (Using UTF-8):

<html lang="zh-CN">
<head>
<meta charset="UTF-8">
</head>
<body>
<div style="background-color:blue;">
Chinese charactors:中文测试<br />
Player Name:<playername><br />
Server Name:<servername><br />
Password:<generatedpass><br />
<image><br />
</div>
</body>
</html>

This's the content of the email I've received:

Chinese charactors:????
Player Name:
Server Name:
Password:

Besides,the Chinese title of the mail I've received displays correctly.Strange.

@smartmadio
Copy link
Author

I've read Xephi@e781115 seems something wrong in email.html,then,another test:
email.html:

<html lang="zh-CN">
<head>
<meta charset="UTF-8">
</head>
<body>
<div style="background-color:blue;">
Chinese charactors:中文测试<br />
Player Name:%playername%<br />
Server Name:%servername%<br />
Password:%generatedpass%<br />
%image%<image><br />
</div>
</body>
</html>

This's content of the mail I've received:

Chinese charactors:????
Player Name:123777
Server Name:YiHaiFengLan Minecraft Server
Password:kofflt1b

<image> or %image% won't work,all Chinese charactors in the mail content displayed as ???.

@smartmadio
Copy link
Author

Testing AuthMeReloaded-Dev #5​83,This version could creat email.html now.
email.html:

<html lang="zh-CN">
<head>
<meta charset="UTF-8">
</head>
<body>
<div style="background-color:#666666;">
Chinese charactors:中文测试<br />
Player Name:<playername><br />
Server Name:<servername><br />
Password:<generatedpass><br />
%image%<image><br />
</div>
</body>
</html>

This's content of the mail I've received:

Chinese charactors:????
Player Name:
Server Name:
Password:
%image%

<image> or %image% won't work,all Chinese charactors in the mail content still displayed as ???.

@smartmadio
Copy link
Author

Delete -Dfile.encoding=UTF-8 and convert email.html to ANSI format.
email.html:

<html lang="zh-CN">
<head>
<meta charset="GBK">
</head>
<body>
<div style="background-color:blue;">
Chinese charactors:中文测试\u4e2d\u6587\u6d4b\u8bd5<br />
Player Name:<playername><br />
Server Name:<servername><br />
Password:<generatedpass><br />
%image%<image><br />
</div>
</body>
</html>

This's content of the mail I've received:

Chinese charactors:????\u4e2d\u6587\u6d4b\u8bd5
Player Name:
Server Name:
Password:
%image%

<image> or %image% won't work,all Chinese charactors in the mail content still displayed as ???.

@Xephi
Copy link
Contributor

Xephi commented Dec 24, 2015

Here is a good usage of the email.html :
https://github.com/AuthMe-Team/AuthMeReloaded/blob/master/src/main/resources/email.html
You need to close the tag like that :

<playername />
<image />
<servername />
<generatedpass />

By the way, i will check why Chinese charactors are not displayed correctly, try to encode email.html as utf-8 :/

@Xephi
Copy link
Contributor

Xephi commented Dec 24, 2015

@smartmadio Can you please try with this build :
http://ci.xephi.fr/job/AuthMeReloaded-Dev/584/

@smartmadio
Copy link
Author

OK,I'll have a try

@smartmadio
Copy link
Author

@Xephi Test finished.The mail content could display Chinese charactors correctly now,thank you:)

@sgdc3 sgdc3 closed this as completed Dec 26, 2015
@sgdc3 sgdc3 removed the Type: bug label Dec 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants