The subject to your problem says it all. This is a syntax error. You cannot wrap the begin and end tags in a conditional statement. That breaks the syntax rules of the ColdFusion parsing engine and seems like a clunky solution anyway. You either want to mail the content or display it, so logically, your condition should have a true condition that mails, and a false condition the displays it.
This is a commonly used technique, especially if you want to do both. It requires less code and is more readable as well. On Thu, Oct 17, 2013 at 1:58 PM, Robert Harrison <[email protected] > wrote: > > I thought of that but it seemed rather unnecessary. It seem like a hack to > get around something that should work. > > > Robert Harrison > Director of Interactive Services > > Austin & Williams > Advertising I Branding I Digital I Direct > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > T 631.231.6600 X 119 F 631.434.7022 > http://www.austin-williams.com > > Blog: http://www.austin-williams.com/blog > Twitter: http://www.twitter.com/austin_williams > > > -----Original Message----- > From: Brian Cain [mailto:[email protected]] > Sent: Thursday, October 17, 2013 2:58 PM > To: cf-talk > Subject: Re: Syntax Problem > > > You should try putting your content into a variable using cfsavecontent > and then choose to display in the browser or send an email. You cannot > wrap the begin and end tags of a cfmail the way you are doing. > > <cfsavecontent var="mycontent"><cfoutput>Your > stuff</cfoutput></cfsavecontent> <cfif generate_email> > <cfmail all your settings>#mycontent#</cfmail> <cfelse> > <cfoutput>#mycontent#</cfoutput> > </cfif> > > Regards, > Brian C > > > On Thu, Oct 17, 2013 at 1:46 PM, Robert Harrison < > [email protected] > > wrote: > > > > > In the statement below, what I missing? > > > > When generate_email=0, I get: Either the end tag > > </cfmail> encountered on line 44 at column 29 requires a matching > > start tag or tag cfmail does not support end tag. > > > > > > <cfif generate_email eq 1><cfmail from="#techadmin#" to=" > > [email protected]" bcc="#techadmin#" Subject="Open House > > Registration Report" server="#smtpid#"></cfif> > > <cfoutput>report details go here</cfoutput> <cfif > > generate_email eq 1></cfmail></cfif> > > > > > > I want to use this setting to either display this report or email the > > report. I don't understand why the switch is disabling the starting > > tag but not the closing tag. > > > > Thoughts? > > > > Thanks > > > > Robert Harrison > > Director of Interactive Services > > > > Austin & Williams > > Advertising I Branding I Digital I Direct > > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > > T 631.231.6600 X 119 F 631.434.7022 > > http://www.austin-williams.com > > > > Blog: http://www.austin-williams.com/blog > > Twitter: http://www.twitter.com/austi > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356932 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

