House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Newbie (CF-Newbie)

cfmail +css

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
John Barrett
08/27/2008 01:32 AM

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 = "johnbarr@hawaii.edu" To = "johnbarr@hawaii.edu" 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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
William Seiter
08/27/2008 01:47 AM

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----- :: ::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 = "johnbarr@hawaii.edu" To = "johnbarr@hawaii.edu" ::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 :: ::

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Michael V. Rigsby
08/27/2008 01:49 AM

Cold fusion will error if you use a single # inside a cfoutput or certain tags. In order to use a single # you need to escape it with another #. Example: john{font-family:"Lucida Grande"; font-size:9px; color: ##FF0000} 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 = "johnbarr@hawaii.edu" To = "johnbarr@hawaii.edu" 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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
John Barrett
08/27/2008 01:59 AM

thanks Michael! John On Aug 26, 2008, at 7:45 PM, Michael V. Rigsby wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
John Barrett
08/27/2008 01:59 AM

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: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-newbie

October 20, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference