CDOSYS and CSS being ignored

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    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("C DO.Message")
    objMail.From = "x@f.com'
    objMail.To = "b@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 & ".notapplie d {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='notappli ed'>not applied</h1>"
    txt = txt & "</body>"
    txt = txt & "</html>"

    objMail.HTMLBod y = txt
    objMail.Send()
    set objMail = Nothing

    Thanks and happy coding
    J
  • Anthony Jones

    #2
    Re: CDOSYS and CSS being ignored

    "James" <kosle@nomail.c omwrote in message
    news:530jc3dh4u etm77crcb75dff8 np2q38pai@4ax.c om...
    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("C DO.Message")
    objMail.From = "x@f.com'
    objMail.To = "b@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 & ".notapplie d {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='notappli ed'>not applied</h1>"
    txt = txt & "</body>"
    txt = txt & "</html>"
    >
    objMail.HTMLBod y = 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


    Comment

    • James

      #3
      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

      Comment

      • Anthony Jones

        #4
        Re: CDOSYS and CSS being ignored

        "James" <kosle@nomail.c omwrote in message
        news:pq5mc3dcug ffuu2bppem2ne1i em9lupdnk@4ax.c om...
        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


        Comment

        • Bob Milutinovic

          #5
          Re: CDOSYS and CSS being ignored

          "James" <kosle@nomail.c omwrote in message
          news:pq5mc3dcug ffuu2bppem2ne1i em9lupdnk@4ax.c om...
          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"

          telephone (0417) 45-77-66
          facsimile (02) 9824-2240


          Comment

          Working...