Search code examples
javaoutlook-2010webmail

webmail font and outlook font differs


I have a java code which sends email. When we open same email on webmails then font remains same but when I open that in outlook then font changes. I am not able to figure it out why this is happening ? Same code is showing different output in different environment. Is that a java code problem or outlook/webmails problem ?
This is actually not a show stopper but still need to rectify as soon as possible, because day by day it will become critical defect for me.


Solution

  • your code must be like following.

     <% String fontName="Times New Roman";
    String htmlString = "<font face="+fontName+"></font>"; // incorrect without single or double quotes %>
    

    Browser can understand 'fontName' variable without quotes but outlook can't understand it.

    <% String fontName="Times New Roman";
    String htmlString = "<font face=\""+fontName+"\"></font>";  //double quotes %>
    

    OR

    <% String fontName="Times New Roman";
    String htmlString = "<font face='"+fontName+"'></font>"; //single quotes %>