CDOSYS and CSS being ignored

J

James

Hello,
I've been testing HTML messages both with CreateMHTMLBody and
HTMLBody, the problem is that the message delivered does not display
css styles correctly. If I use "style" inside html tags within the
"body" the style is applyed. But if I put the styles within the "head"
tags and then reference to them with "class" the styles get completely
ignored.

The complete html code obviusly displays well on browsers.

Here are few lines of code

Set objMail = CreateObject("CDO.Message")
objMail.From = "(e-mail address removed)'
objMail.To = "(e-mail address removed)"
objMail.Subject = "sbj"

txt = txt & "<html>"
txt = txt & "<head>"
txt = txt & "<META http-equiv='Content-Type' content='text/html;
charset=iso-8859-1'>"
txt = txt & "<style type='text/css'>"
txt = txt & "<!--"
txt = txt & ".notapplied {font-family: Arial, Helvetica, sans-serif;
color: #074B89; font-size: 56px; font-weight: bold; }"
txt = txt & "-->"
txt = txt & "</style>"
txt = txt & "</head>"
txt = txt & "<body>"
txt = txt & "<br><h1 style='font-family: Arial, Helvetica, sans-serif;
color: #074B89; font-size: 56px; font-weight: bold;'>applied</h1>"
txt = txt & "<br><h1 class='notapplied'>not applied</h1>"
txt = txt & "</body>"
txt = txt & "</html>"

objMail.HTMLBody = txt
objMail.Send()
set objMail = Nothing

Thanks and happy coding
J
 
A

Anthony Jones

James said:
Hello,
I've been testing HTML messages both with CreateMHTMLBody and
HTMLBody, the problem is that the message delivered does not display
css styles correctly. If I use "style" inside html tags within the
"body" the style is applyed. But if I put the styles within the "head"
tags and then reference to them with "class" the styles get completely
ignored.

The complete html code obviusly displays well on browsers.

Here are few lines of code

Set objMail = CreateObject("CDO.Message")
objMail.From = "(e-mail address removed)'
objMail.To = "(e-mail address removed)"
objMail.Subject = "sbj"

txt = txt & "<html>"
txt = txt & "<head>"
txt = txt & "<META http-equiv='Content-Type' content='text/html;
charset=iso-8859-1'>"
txt = txt & "<style type='text/css'>"
txt = txt & "<!--"
txt = txt & ".notapplied {font-family: Arial, Helvetica, sans-serif;
color: #074B89; font-size: 56px; font-weight: bold; }"
txt = txt & "-->"
txt = txt & "</style>"
txt = txt & "</head>"
txt = txt & "<body>"
txt = txt & "<br><h1 style='font-family: Arial, Helvetica, sans-serif;
color: #074B89; font-size: 56px; font-weight: bold;'>applied</h1>"
txt = txt & "<br><h1 class='notapplied'>not applied</h1>"
txt = txt & "</body>"
txt = txt & "</html>"

objMail.HTMLBody = txt
objMail.Send()
set objMail = Nothing


Ignored by what? Outlook Express? Outlook? Thunderbird? A Web based email
agent like Gmail or hotmail?
 
J

James

Ignored by what? Outlook Express? Outlook? Thunderbird? A Web based email
agent like Gmail or hotmail?

Ignored by Gmail web interface, OE displays both solutions correctly.

Anyway I do receive html mails with css in the head, as a matter of
fact the MSDN newsletter has css in the head and looks perfect via
web.

What can it be?

Thanks
J
 
A

Anthony Jones

James said:
Ignored by Gmail web interface, OE displays both solutions correctly.

Anyway I do receive html mails with css in the head, as a matter of
fact the MSDN newsletter has css in the head and looks perfect via
web.

What can it be?

I don't know anything about GMail you would have to ask some where more
appropriate for GMail questions.
 
B

Bob Milutinovic

James said:
Ignored by Gmail web interface, OE displays both solutions correctly.

Anyway I do receive html mails with css in the head, as a matter of
fact the MSDN newsletter has css in the head and looks perfect via
web.

What can it be?

Examine the names used for class definitions in the working MSDN newsletter,
then examine yours.

It's quite possible that you've used one or more names which overlap those
used by Google.

--
Bob Milutinovic
Cognicom - "Australia's Web Presence Specialists"
http://www.cognicom.net.au/
telephone (0417) 45-77-66
facsimile (02) 9824-2240
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,614
Members
45,287
Latest member
Helenfem

Latest Threads

Top