none
Outlook options - New Mail Message Font C# RRS feed

  • Question

  • How does one get the font name that the user selected in the 'Outlook options - New Mail Message Font', via C#?

    Here is what I wish to do:

    1) Get the Font Name that the user selected as their default for New Mail Messages

    2) Add Text to the Body of the email, using the font name in step 1 (The email is a HTML formatted email)

    I know how to do item 2 if I hard code the font name

    This is for Outlook 2010 on Windows 7 machines

    Friday, January 4, 2013 1:45 PM

Answers

  • Here is the catch, Outlook Object Model doesn't provide way to set the font for HTML messages. But from Outlook 2007 onwards, Microsoft Office Outlook 2007 uses the HTML parsing and rendering engine from Microsoft Office Word 2007 to display HTML message bodies. So you can try the above said Word Object model or directly embedding HTML content with font tag and see whether it helps you to move ahead or not.

    You can have a look at the article "Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)" about supported HTML/CSS tags- http://msdn.microsoft.com/en-us/library/office/aa338201(v=office.12).aspx

    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Monday, January 7, 2013 6:13 PM

All replies

  • I want to know how to create a new mail message and set the font to Calibri not Times New Roman?

    Some background: when I create new email I get Calibri but when I create a new email via C# I get Times New Roman for a font.  I noticed the behavior when sharing from OneNote.


    Thanks/Regards, Mike DePouw

    Sunday, January 6, 2013 2:09 AM
  • I was able to answer my own question.

    I pre-pended my body with a font tag and it worked!

    Message.HTMLBody = "<FONT face=\"Calibri\">";

    Message.HTMLBody += Body;


    I got the idea from here:

    http://stackoverflow.com/questions/12514355/sending-an-outlook-mail-item-from-a-c-sharp-application


    Thanks/Regards, Mike DePouw

    Sunday, January 6, 2013 2:17 AM
  • This would be great if I wanted to hard code the font name, however I need to get the font name from that the user selected in the 'Outlook options - New Mail Message Font'

    The users will not always set the font to Calibri.

    Monday, January 7, 2013 12:38 PM
  • get Document interface from Inspector.WordEditor (which returns Word's Document) and read Font.Name from first paragraph, selection, whatever.
    Monday, January 7, 2013 12:47 PM
  • Here is the catch, Outlook Object Model doesn't provide way to set the font for HTML messages. But from Outlook 2007 onwards, Microsoft Office Outlook 2007 uses the HTML parsing and rendering engine from Microsoft Office Word 2007 to display HTML message bodies. So you can try the above said Word Object model or directly embedding HTML content with font tag and see whether it helps you to move ahead or not.

    You can have a look at the article "Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)" about supported HTML/CSS tags- http://msdn.microsoft.com/en-us/library/office/aa338201(v=office.12).aspx

    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Monday, January 7, 2013 6:13 PM