Adds UTF-8 charset to emails

This commit is contained in:
Ariel D. Moya Sequeira 2016-01-08 10:06:20 -06:00 committed by Graham Triggs
parent 9a2cc3a9cc
commit 8660ed91eb

View file

@ -172,15 +172,15 @@ public class FreemarkerEmailMessage {
if (htmlContent.isEmpty()) { if (htmlContent.isEmpty()) {
log.error("Message has neither text body nor HTML body"); log.error("Message has neither text body nor HTML body");
} else { } else {
msg.setContent(htmlContent, "text/html"); msg.setContent(htmlContent, "text/html; charset=UTF-8");
} }
} else { } else {
if (htmlContent.isEmpty()) { if (htmlContent.isEmpty()) {
msg.setContent(textContent, "text/plain"); msg.setContent(textContent, "text/plain; charset=UTF-8");
} else { } else {
MimeMultipart content = new MimeMultipart("alternative"); MimeMultipart content = new MimeMultipart("alternative");
addBodyPart(content, textContent, "text/plain"); addBodyPart(content, textContent, "text/plain; charset=UTF-8");
addBodyPart(content, htmlContent, "text/html"); addBodyPart(content, htmlContent, "text/html; charset=UTF-8");
msg.setContent(content); msg.setContent(content);
} }
} }