HTML emails are sent as text

Hi,
if you have an email template that starts with a valid html declaration like

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

the content type is considered as text. The problem resides in the EmailSender#getContentBodyType method:

if (text.trim().startsWith("<html>")) {
     bodyContentType = "text/html; charset=UTF-8";
} else {
     bodyContentType = "text/plain; charset=UTF-8";
}

this IMHO a too simplistic approach to determine a message’s content type.

A more reliable solution would be refactoring emailing methods, to be able to specify content type explicitly.

Thx
Paolo

1 Like

Agree. Created issue: https://youtrack.cuba-platform.com/issue/PL-9993