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!:slight_smile:

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.

I am assuming that it may not be possible to have any kind of css formating within the cfmail tags? :confused:

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! :slight_smile:

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.


<cfsavecontent variable="mailBody">
[INDENT][/INDENT]My HTML Code goes in here
</cfsavecontent>

<cfmail>
#mailBody#
</cfmail>

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.

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.

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!) :wink: