genkgo / mail

Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
https://mail.readthedocs.io/
Other
402 stars 21 forks source link

About the encoding of AlternativeText #95

Closed riku22 closed 3 years ago

riku22 commented 3 years ago

Hello.

Currently, Base64 is specified as the encoding of AlternativeText, but I would like to change it to encode with 8bit. As a test, I added withHeader(new ContentTransferEncoding("8bit")), but the base64-encoded character string was displayed as it was in the body. Is there any way?

Best regards.

frederikbosch commented 3 years ago

If you are using Chinese characters, it will automatically become base64, not 8bit. What is the text you are inserting?

riku22 commented 3 years ago

Hello.

Hmm, I see. I use Japanese for the text.

Best regards.

frederikbosch commented 3 years ago

The content transfer encoding for a plain text part is decided on its content via the OptimalTransferEncodedTextStream. If the content does contain any non 7bit character, then the second question is what will generate the smallest size between quoted-printable and base64. I guess with Japanese characters base64 is a more optimal solution than quoted-printable.

The same methodology is used for html parts.

riku22 commented 3 years ago

Hello.

OK, I see. thank you very much.

Best regards.