Hi William, Thanks so much for your help! I have done the "Escaping" and the page now does not give an error. This is probably a good lesson for me to learn, as I knew about your example with the outputting of a variable with #...# but I did not know about the single # sign,and if I needed to use that for something (CSS) in the case I could use the double ##.
Thanks so much for your help. John On Aug 26, 2008, at 7:43 PM, William Seiter wrote: > As you have probably seen already the '#' in coldfusion is used to > start and > end the translation process of a variable. > Eg > <cfset mycolor = "red"> > <cfoutput>#mycolor#</cfoutput> > > If you wanted to use the '#' symbol in your display, you would need to > 'escape' it. Escaping is simply doubling the symbol so that CF > knows that > you wanted the displayed version of the symbol, not the translation > of the > variable name after it. > <cfset mycolor = "##FF0000"> > <cfoutput>#mycolor#</cfoutput> > > The above code is an example of what you are looking for. > > After CF is done 'processing' the code, the resulting html would > simply show > #FF0000 on the page. > > In your case, you need it inside of a cfmail tag. The same principle > applies. > <cfmail ...> > <strong style="color:##FF0000">This is an Email</strong> > </cfmail> > > Because you are inbetween an opening and closing CF tag (<cfmail>) > you still > need to 'escape' the '#' symbol. > > Hope this helps, > William > > > ---------------------------------- > William Seiter > ColdFusion Web Developer / Consultant > http://william.seiter.com > > Free Website Trade Publication >> Website Magazine > http://www.websitemagazine.com/referrals/?id=51344&f=text2 > Don't forget to answer the survey questions, it's a 10 second task , > a very small request for access to this incredible resource. > > > > ::-----Original Message----- > ::From: John Barrett [mailto:[EMAIL PROTECTED] > ::Sent: Tuesday, August 26, 2008 10:27 PM > ::To: CF-Newbie > ::Subject: cfmail +css > :: > ::Hi, I am trying to add styles to a cfmail app. This is just > testing, as > ::the final one will look like a web-page, but be delivered over > e0,ail > ::using cfmail. I see this all the time, and even hostmysite sends > me mails > ::like this. > :: > ::Is there a reason why I can't use color:#FF0000 for red? when I > have red > ::in the color in the style tag, it works, and sends the mail, but > if I use > ::the color code, I get an CF error. > :: > ::--------Error Message---------------- > ::Invalid CFML construct found on line 16 at column 74. > :: > ::ColdFusion was looking at the following text: > ::} > :: > ::The CFML compiler was processing: > :: > ::An expression that began on line 16, column 67. > ::The expression might be missing an ending #, for example, #expr > instead of > ::#expr#. > ::The body of a cfmail tag beginning on line 1, column 2. > :: > ::The error occurred in /Users/johnbarrett/Sites/primitive/ > CSS_Email.cfm: > ::line 16 > ::14 : body{font-family:Arial, Helvetica, sans-serif;font-size: > 18px} > ::15 : logo{font-family:Arial, Helvetica, sans-serif; font-size: > 11px} > ::16 : john{font-family:"Lucida Grande"; font-size:9px; > color:#FF0000} > ::17 : </style> > ::18 : </head> > :: > ::<!--- working code---> > :: <cfmail from = "[EMAIL PROTECTED]" To = "[EMAIL PROTECTED]" > ::Subject = "Which version do you see?"> > :: <cfmailpart > :: type="text" > :: wraptext="74"> > :: You are reading this message as plain text, because your > mail > ::reader > :: does not handle HTML text. > :: </cfmailpart>> > :: <cfmailpart > :: type="html"> > :: <html> > :: <head> > :: <style> > :: body{font-family:Arial, Helvetica, sans-serif;font-size:18px} > :: logo{font-family:Arial, Helvetica, sans-serif; font-size:11px} > :: john{font-family:"Lucida Grande"; font-size:9px; red} > :: </style> > :: </head> > :: <body> > :: > :: > :: <div class="body"> > :: > :: <h3>HTML Mail Message</h3> > :: <p>You are reading this message as <strong>HTML</ > strong>.</p> > :: <div class="john"> > :: <p>Your mail reader handles HTML text.</p> > :: </div> > :: </div> > :: </body> > :: </html> > :: </cfmailpart> > ::</cfmail> > :: > :: > ::Thanks in advanced John > :: > :: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3946 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
