Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS in Outlook HTML messages 1

Status
Not open for further replies.

JPJeffery

Technical User
May 26, 2006
600
GB
Hi

I have a VB Script which queries various IT systems then produces and HTML report which it saves as a file on the file server and uses this also to produce an HTML format e-mail.

I've been rewriting the HTML code produced by the VB script to use CSS. This new style code is working fine when I open the .htm file, in that it's using the Verdana/Sans-serif font/font-family I've specified, but the Outlook e-mail is now displayed as Times New Roman.

I can bully it in to submission by using an old-style <font face="Verdana"> tag but that just throws out the CSS!

It shouldn't be this hard, should it?

Here's an example of the resultant code:
Code:
<HTML>
<HEAD>
<TITLE>IT Systems Checks Report</TITLE>
<STYLE TYPE="text/css">
<!--
BODY { background-color: #FFFFFF;
       font-family: Verdana;
       font-size : 100% }
       color : #000000 }
.OK   { font-family: Verdana,SANS-SERIF; color: #000000}
.Warn { color: #FF6600}
.Err  { color: #ff0000}
-->
</STYLE>
<SPAN CLASS="OK"><b>IT Systems Checks report for 07/07/2009 (script v1.36 - 06/07/2009)</b><br><br>
<hr><b><i>SUMMARY OF ISSUES FOUND:<br> (for "Script Output / Description" field on TeamWorks portal page)</i></b><br>
PRT01\Spooler<br>
SRV02\Spooler<br>
<hr><b><i>FOLLOW-UP ACTIONS:<br> (for "Comments" field on TeamWorks portal page)</i></b><br>
&nbsp;&nbsp;PRT01\Spooler:<br>
&nbsp;&nbsp;&nbsp;&nbsp;J <br>
&nbsp;&nbsp;SRV02\Spooler:<br>
&nbsp;&nbsp;&nbsp;&nbsp;J<br>
<hr><b><i>FULL REPORT:</i></b><br>
<FONT color=#000000><i>Internet access</i><br>
&nbsp;&nbsp;OK<br>
<br>
<FONT color=#000000><i>BlackLists Listing</i><br>
&nbsp;&nbsp;Not currently listed in the BlackLists<br>
<br>
<FONT color=#000000><i>Print Services</i><br>
<FONT color=#000000>&nbsp;&nbsp;PRT01 -<SPAN CLASS="Err">&nbsp;&nbsp; Spooler service failed to respond to query<br></SPAN>
<FONT color=#000000>&nbsp;&nbsp;HKPRT -<FONT color=#000000>&nbsp;&nbsp;Hong Kong Print Spooler service online<br>
<FONT color=#000000>&nbsp;&nbsp;SRV02 -<SPAN CLASS="Err">&nbsp;&nbsp; Spooler service failed to respond to query<br></SPAN>
<br>
<FONT color=#000000><i>Follow-up Actions for errors</i><br>
&nbsp;&nbsp;PRT01\Spooler:<br>
&nbsp;&nbsp;&nbsp;&nbsp;J <br>
&nbsp;&nbsp;SRV02\Spooler:<br>
&nbsp;&nbsp;&nbsp;&nbsp;J<br>
<FONT color=#000000><br><br>
&nbsp;&nbsp;*** END OF REPORT ***<br>
(Note that code such as '<FONT color=#000000>' is due to be replaced by the appropriate <SPAN CLASS=' lines.)

So, what the heck is going on when the HTML e-mail is being produced/displayed in Times New Roman?

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
You need to use inline styles for Outlook email.
Code:
<div style="font-family: Verdana;">
or 
<p style="font-family: Verdana;">


Don't even get me started on this epic failure from Microsoft.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
For much greater detail and explanation, see (among other places): How to Code HTML Email Newsletters on sitepoint.



Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Greg

Thank you.

(*mumble*Inline Styles, indeed*mutter*In this day and age!*grumble*stoopid Microsoft*mumble*)



JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top