fearofawhackplanet
fearofawhackplanet

Reputation: 53396

Email html font size in Outlook

<div style="font-family: Arial; font-size: 10px;">TEST</div>

I'm providing the above source as an html email to Outlook 2007, and it's rendering 7.5px font. Any ideas of what hack I need to make this work?

Edit: I'm setting the mail contents with body, like:

new MailMessage
{
    IsBodyHtml = true,
    Body = "<div style=\"font-family: Arial; font-size: 10px;\">TEST</div>"
};

I don't believe this is related though. Note that if I view source in the generated email the html is as expected. The problem seems to be only that outlook doesn't render it correctly for whatever reason.

Upvotes: 4

Views: 17396

Answers (2)

PCasagrande
PCasagrande

Reputation: 5402

The issue is that most email programs understand very little, if any, CSS. Try specifying the font details using the old, non-CSS methods. This method is deprecated, but unfortunately it is what we have to do to style the emails. It also prevents exact sizing of fonts.

new MailMessage
{
    IsBodyHtml = true,
    Body = "<font face=\"Arial\" size=\"1\">TEST</font>"
};

Upvotes: 9

JimmyPena
JimmyPena

Reputation: 8764

A few suggestions:

  • Use the HTMLBody property instead of Body when creating HTML emails.
  • Do your quotes need to be escaped like that? I've never seen that before, but I'm used to VB where literal quotes are doubled.
  • Check your read settings, you may be reading emails as plain text.

Upvotes: 0

Related Questions