Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMAIL

Status
Not open for further replies.

danarashad

Programmer
Nov 2, 2006
115
US
is it possible to have and if statement inside of a <CFmail tag.
example
<cfmail to=dana@something.com from=dana1@something.com <cfif variable is "test">CC=dana3@something.com</cfif>
>
blah blah
</cfmail>
when i run it i get an error invalid token c and it points to the 'c' from the CC!
 
in general no. You can't have a cf tag within the content of another cf tag. If it was within the quotes of the tag then that should be ok, but not where you have put it. not sure as i try to stear away from them, but an Iif might work, but you'd be better off putting an if around the lot to be honest

Hope this helps!

Tony
 
You can do something like this:
Code:
<cfif variable is "test">
  <cfset CCEmail = "dana3@something.com">
<cfelse>
  <cfset CCEmail = ""> 
</cfif> 

<cfmail to="dana@something.com" from="dana1@something.com" cc="#CCEmail#">
  blah blah
</cfmail>



____________________________________
Just Imagine.
 
Deadlywiper - just out of curiosity - why don't you like the IIF? Is it a performance issue with using it?

Thanks

Jonas
 
nice article. you looking for a job?

IIF isn't bad if you need to use IF as a function. I don't use it to much, but it's gotten me out of a pinch or two.

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top