Search code examples
javaemailoutlookjakarta-mailhtml-email

Is it possible to set color to email subject?


Is it possible to set color to email subject? I tried this below which did not work.

//subject = "<FONT COLOR=\"#ff0000\">" + subject + "</FONT>";
subject = "&lt;FONT COLOR=&quot;#ff0000&quot;&gt;Test Subject&lt;/FONT&gt;";
String yourEncodedString = MimeUtility.encodeText(subject, "UTF-8", "B");
message.setHeader("Subject", yourEncodedString);
message.setSubject(yourEncodedString,  "UTF-8");   

Solution

  • Coloring is not a email or SMTP feature. It is ability of client to show HTML documents. Clients that support HTML format parse email body only and show subject as-is. Therefore subject remains as it was created.

    So, the bottom line: no you cannot send email with colored subject. I am sorry...