CDOSYS and CSS being ignored
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 = "x [at] f.com'
objMail.To = "b [at] g.com"
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
Re: CDOSYS and CSS being ignored
"James" <kosle [at] nomail.com> wrote in message
news:530jc3dh4uetm77crcb75dff8np2q38pai [at] 4ax.com...
> 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 = "x [at] f.com'
> objMail.To = "b [at] g.com"
> 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?
--
Anthony Jones - MVP ASP/ASP.NET
Re: CDOSYS and CSS being ignored
On Mon, 20 Aug 2007 21:11:29 +0100, "Anthony Jones" wrote:
>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
Re: CDOSYS and CSS being ignored
"James" <kosle [at] nomail.com> wrote in message
news:pq5mc3dcugffuu2bppem2ne1iem9lupdnk [at] 4ax.com...
> On Mon, 20 Aug 2007 21:11:29 +0100, "Anthony Jones" wrote:
>
> >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?
>
I don't know anything about GMail you would have to ask some where more
appropriate for GMail questions.
--
Anthony Jones - MVP ASP/ASP.NET
Re: CDOSYS and CSS being ignored
"James" <kosle [at] nomail.com> wrote in message
news:pq5mc3dcugffuu2bppem2ne1iem9lupdnk [at] 4ax.com...
> On Mon, 20 Aug 2007 21:11:29 +0100, "Anthony Jones" wrote:
>
>>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?
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