SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Cfmail & CSS

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cfmail & CSS

    Hi,

    I have been attempting to send a Cfmail generated e-mail to my gmail account, but so far have not been able to get it to show any kind of css formatting.

    Below is a sample of how I am embedding the CSS into Cfmail.

    <cfmail
    subject="Some Title"
    from="someemail@mysite.com <someemail@mysite.com>"
    to="otheremail@gmail.com"
    type = "text/html"
    >

    <html>
    <head>

    <style type="text/css">

    ##style1 {
    font-size:18px;
    color:##999900;
    }
    </style>

    </head>


    <body>

    <div id="style1">This is a test style</div>

    </body>

    </html>

    </cfmail>


    Could anyone enlighten me to point out to me what I am doing wrongly? Thanks a bunch!

    btw, if anyone is wondering why I am using 2 ##, if I don't I will get a Cf error. I believe using the 2 ## tells Cf to ignore it as a processing tag.

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am assuming that it may not be possible to have any kind of css formating within the cfmail tags?

    I wonder how the other web languages accomplish it as I often receive mail that look like perfectly formatted webpages.....

    Any insight on this would be helpful. Thanks!

  3. #3
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Aberdeen, Scotland
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am assuming that it may not be possible to have any kind of css formating within the cfmail tags?
    You're assuming is wrong as it's been able to handle it for many years .

    You say you've tested this on Gmail but have you tried it on any other email app? At least that eliminates if that is the problem here.

    You could also try creating your mail body with <cfsavecontent> and placing that result in the cfmail tag instead i.e.

    Code:
    <cfsavecontent variable="mailBody">
    My HTML Code goes in here
    </cfsavecontent>
    
    <cfmail>
    #mailBody#
    </cfmail>

  4. #4
    SitePoint Guru downtroden's Avatar
    Join Date
    Dec 2004
    Location
    illinois
    Posts
    978
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    gmail strips out the html and body tags, so those are just a waste of your time.

    Get a basic template from mailchimp.com and alter to suit your needs.

    Also, have you tried mailpart for the content? You're going to want plaintext as well if you're sending an html email.
    your brain reacts in the same way whether you are
    looking at something or thinking about it...

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey There downtroden,

    Nice to hear from you again .

    Well, when i open my gmail, I can receive e-mails that cleary show formatting that looks like webpages. If i can see e-mails sent by others that show html formattting, why can't I see the formatting done by the css code in my own generated cfmails?

    But , I much appreciate your inputs! I will go ahead and try some of the suggestions you offered and see if that any of those work.


    Quote Originally Posted by downtroden View Post
    gmail strips out the html and body tags, so those are just a waste of your time.

    Get a basic template from mailchimp.com and alter to suit your needs.

    Also, have you tried mailpart for the content? You're going to want plaintext as well if you're sending an html email.

  6. #6
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Aberdeen, Scotland
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do a Google on it as I'm seeing numerous other posts with people having the same problem with GMail & Yahoo and getting suggestions on how it could be fixed.

    Unfortunately none of the people that have had the problem bothered to reply and say how they fixed it, so let us know how you manage it (I'm nosey like that!)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •