[GH-ISSUE #18] Japanese, Chinese, or Korean text not showing up properly #15

Closed
opened 2026-03-15 12:05:10 +03:00 by kerem · 6 comments
Owner

Originally created by @rogerdz on GitHub (Oct 17, 2022).
Original GitHub issue: https://github.com/axllent/mailpit/issues/18

I have Maipit running on a Docker container, with the following command:
docker run -d \ --restart unless-stopped \ --name=mailpit \ -p 8025:8025 \ -p 1025:1025 \ axllent/mailpit

2022-10-18_01-09
2022-10-18_01-10

Originally created by @rogerdz on GitHub (Oct 17, 2022). Original GitHub issue: https://github.com/axllent/mailpit/issues/18 I have Maipit running on a Docker container, with the following command: `docker run -d \ --restart unless-stopped \ --name=mailpit \ -p 8025:8025 \ -p 1025:1025 \ axllent/mailpit` ![2022-10-18_01-09](https://user-images.githubusercontent.com/78783748/196251144-5b94d70e-ce35-4029-86d8-a3c3f5485f08.png) ![2022-10-18_01-10](https://user-images.githubusercontent.com/78783748/196251190-8c33fb68-039c-4849-8345-b529b258216d.png)
kerem closed this issue 2026-03-15 12:05:16 +03:00
Author
Owner

@axllent commented on GitHub (Oct 17, 2022):

Thank you. Are you able to attach an example email to this issue so I can do further testing please?

<!-- gh-comment-id:1281321063 --> @axllent commented on GitHub (Oct 17, 2022): Thank you. Are you able to attach an example email to this issue so I can do further testing please?
Author
Owner

@rogerdz commented on GitHub (Oct 18, 2022):

I attach example mail:
57646be0-8dbe-4ebf-89b4-fd5c32fda3d8.zip

I use command line for test send mail:
echo -e "To:receiver1@domain1, receiver2@domain2 \nSubject:Subject of email 熟語ルビの例 일욜에 만나~ 读写汉字 اثنا عشر شهرا في كتاب Tiếng việt \n\nBody of email. 熟語ルビの例 일욜에 만나~ 读写汉字 اثنا عشر شهرا في كتاب Tiếng việt\n" | /usr/sbin/sendmail -f sender@domain -F sendername -it

<!-- gh-comment-id:1281733848 --> @rogerdz commented on GitHub (Oct 18, 2022): I attach example mail: [57646be0-8dbe-4ebf-89b4-fd5c32fda3d8.zip](https://github.com/axllent/mailpit/files/9805860/57646be0-8dbe-4ebf-89b4-fd5c32fda3d8.zip) I use command line for test send mail: `echo -e "To:receiver1@domain1, receiver2@domain2 \nSubject:Subject of email 熟語ルビの例 일욜에 만나~ 读写汉字 اثنا عشر شهرا في كتاب Tiếng việt \n\nBody of email. 熟語ルビの例 일욜에 만나~ 读写汉字 اثنا عشر شهرا في كتاب Tiếng việt\n" | /usr/sbin/sendmail -f sender@domain -F sendername -it`
Author
Owner

@axllent commented on GitHub (Oct 18, 2022):

Thank you. I can confirm the issue, I'm just not sure what to do about it. I'll do a bit more testing, but it appears to be a limitation of https://github.com/jhillyerd/enmime (which Mailpit uses to parse emails), so I may have to ask there what, if anything, can be done. The email itself does not specify the encoding / character type anywhere, so I think it is guessing (wrong).

<!-- gh-comment-id:1282006785 --> @axllent commented on GitHub (Oct 18, 2022): Thank you. I can confirm the issue, I'm just not sure what to do about it. I'll do a bit more testing, but it appears to be a limitation of https://github.com/jhillyerd/enmime (which Mailpit uses to parse emails), so I may have to ask there what, if anything, can be done. The email itself does not specify the encoding / character type anywhere, so I think it is guessing (wrong).
Author
Owner

@rogerdz commented on GitHub (Oct 18, 2022):

I don't have much experience with go, but in nodejs email processing library (example: https://github.com/mazira/mailparser-mit) there is an option defaultCharset (set value is utf-8) to handle when email does not specify charset.
You can check https://github.com/jhillyerd/enmime to see if there is something similar ^^

<!-- gh-comment-id:1282612309 --> @rogerdz commented on GitHub (Oct 18, 2022): I don't have much experience with go, but in nodejs email processing library (example: https://github.com/mazira/mailparser-mit) there is an option defaultCharset (set value is utf-8) to handle when email does not specify charset. You can check https://github.com/jhillyerd/enmime to see if there is something similar ^^
Author
Owner

@axllent commented on GitHub (Oct 19, 2022):

I believe we've gotten to the bottom of it. The problem here is that the email RFC clearly states that the default content type for all email is "text/plain; charset=us-ascii", so anything outside of this should be set in the email headers. Whilst the email library Mailpit uses does try guess this (if not set), it is not reliable.

In your case you should be defining the correct content type in your email headers to handle the characters, and not expecting the email client to guess correctly.

<!-- gh-comment-id:1283198045 --> @axllent commented on GitHub (Oct 19, 2022): I believe we've [gotten to the bottom of it](https://github.com/jhillyerd/enmime/issues/266). The problem here is that the [email RFC](https://www.w3.org/Protocols/rfc1341/7_1_Text.html) clearly states that the default content type for all email is `"text/plain; charset=us-ascii"`, so anything outside of this should be set in the email headers. Whilst the email library Mailpit uses does try guess this (if not set), it is not reliable. In your case you should be defining the correct content type in your email headers to handle the characters, and not expecting the email client to guess correctly.
Author
Owner

@axllent commented on GitHub (Oct 19, 2022):

I can confirm that setting the Content-Type: text/plain; charset="UTF-8" header in the email headers fixes the issue entirely in the UI as the mail parser in Mailpit (or any email program) then knows what character set to use when decoding the email 👍

<!-- gh-comment-id:1283665000 --> @axllent commented on GitHub (Oct 19, 2022): I can confirm that setting the `Content-Type: text/plain; charset="UTF-8"` header in the email headers fixes the issue entirely in the UI as the mail parser in Mailpit (or any email program) then knows what character set to use when decoding the email :+1:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#15
No description provided.