Author Message
lefteris
Joined: Jan 16, 2014
Messages: 30
Offline
Hi,

I am trying to use addBodyPart with ContentType.TEXT_HTML but I cannot set encoding to UTF-8 using <meta>. Recipient receives email which contains ????? for non-latin characters when I am using

emailRequest.addBodyPart(ContentType.TEXT_HTML, string);

This problem does not exist when I am using

emailRequest.setTextBody(string)

where all characters are correct. It is also working without issues when I am using

emailRequest.addBodyPart(ContentType.TEXT_PLAIN, string);

Have anyone tried to use UTF-8 encoding when sending ContentType.TEXT_HTML?


Regards,
uhaani
Joined: Jun 9, 2016
Messages: 8
Offline
Hi,

We have not tried sending UTF-8 Encoding to HTML content type. Please use ContentType.TEXT_HTML without encoding.
lefteris
Joined: Jan 16, 2014
Messages: 30
Offline
For EmailRequest you can set body part as below

addBodyPart(ContentType contentType, String content)

So UTF-8 is set inside the html string (content) as below

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Using or not meta , the problem remains when using ContentType.TEXT_HTML.

It's working only with ContentType.TEXT_PLAIN but then you can see the full html document. I have tested with multiple recipients like outlook, gmail, yahoo and for all the clients the problem is the same. Special or no-latin characters cannot be viewed.

Regards,
JoelEzell
Joined: Nov 15, 2013
Messages: 780
Offline
I've submitted an enhancement request to allow configuration of the encoding scheme to be used with Content-Type HTML.
Go to:   
Mobile view