none
Custom font not working in MailMessage RRS feed

  • Question

  • <style type="text/css">p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 12.0px Times; color: #000000; -webkit-text-stroke: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Courier; color: #000000; -webkit-text-stroke: #000000} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px 'Courier New'; color: #000000; -webkit-text-stroke: #000000} span.s1 {font-kerning: none} span.s2 {font: 12.0px 'Courier New'; font-kerning: none} span.s3 {font: 12.0px Courier; font-kerning: none} </style>

    Hi,

    I am trying to send below body using MailMessage and the IsBodyHtml is working fine but I am not getting the expected font.

    Where is the problem here?

    body = "<html dir='rtl' lang='ar'>";
    
    body += "<head>";
    
    body += "<meta charset='UTF-8'>";
    
    body += "<meta name='viewport' content='width=device-width, initial-scale=1.0'>";
    
    body += "<link href='https://fonts.googleapis.com/css?family=Changa&amp;subset=arabic' rel='stylesheet' />";
    
    body += "</head>";
    
    body += "<body dir='rtl' lang='ar' style='font-family: Changa'>";
    
    body += "<h1 style='font-family: Changa'>السلام عليكم " + App.getUserInfo("JafariaUserFirstName") + "</h1>";
    
    body += "تم استلام الحجز التالي وسيتم الاتصال بكم لتأكيد الحجز:<br /><br />";
    
    body += "<br /><br />";
    
    body += "شكرا<br />";
    
    body += "<br /><br />";
    
    dubai.com</a>";
    
    body += "</body>";
    
    body += "</html>";

    Thanks,

    Jassim



    Tuesday, July 24, 2018 2:55 AM

All replies

  • Hi Jassim Rahma,

    Thank you for posting here.

    For your question, if you want to specify the font in your email, you should use Html email format instead of Plain text email format.

    Please refer to the example in the link below.

    https://www.emailarchitect.net/easendmail/kb/csharp.aspx?cat=6

    Best Regards,

    Wendy

    Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 25, 2018 2:38 AM
    Moderator
  • I am using HTML but custom font is still not shown
    Sunday, September 1, 2019 12:24 AM
  • You problem is most likely because of Link tag within Head tags is not supported by a number of webmail.

    Check this link for compatability.

    Thursday, September 5, 2019 8:58 AM
    Answerer