0
CFMAIL and adding CC if needed
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/td-p/181524
Aug 03, 2008
Aug 03, 2008
Copy link to clipboard
Copied
I am currently looping over a list of email addresses and
sending out the
mail to all users. I'd like to instead check to see if a variable is set,
and add the cc="" in the cfmail tag instead.
When I try this it fails, I simply did a <cfif MailCC neq
"">cc="name@site.com"</cfif> in the cfmail tag, but it doesn't seem to like
this.
Has anyone done anything similar?
Or how can I get this to work?
Thanks!
mail to all users. I'd like to instead check to see if a variable is set,
and add the cc="" in the cfmail tag instead.
When I try this it fails, I simply did a <cfif MailCC neq
"">cc="name@site.com"</cfif> in the cfmail tag, but it doesn't seem to like
this.
Has anyone done anything similar?
Or how can I get this to work?
Thanks!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181525#M16350
Aug 03, 2008
Aug 03, 2008
Copy link to clipboard
Copied
i have not tried it, but i know several ways to make it work:
1) put your whole CFMAIL tag inside a cfif block checking for MailCC var
. you will have 2 complete cfmail tags - one executed when MailCC var
exists (this one will have the cc=".." attribute in it), another
(without cc) executed when MailCC var is empty:
<cfif len(trim(MAilCC))>
<cfmail cc="..." ...>
...
</cfmail>
<cfelse>
<cfmail ...><!--- no cc attrib in this one --->
...
</cfmail>
</cfif>
2) use attributeCollection attribute of cfmail tag. assumes you are on
cf8. (or is it only update 1 that allows using attributeCollection
together with in-tag attributes? if so, you have to be on cf8.0.1).
something like:
<cfscript>
mailAttr = {};
mailAttr.server = "mail.somedomain.com";
mailAttr.username = "...";
mailAttr.password = "...";
mailAttr.from = "name@somedomain.com";
mailAttr.subject = "mail subject here";
if (len(trim(MailCC)) gt 0)
mailAttr.cc = "ccname@somedomain.com";
</cfscript>
<cfmail to="..." attributeCollection="#mailAttr#">
...
</cfmail>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
1) put your whole CFMAIL tag inside a cfif block checking for MailCC var
. you will have 2 complete cfmail tags - one executed when MailCC var
exists (this one will have the cc=".." attribute in it), another
(without cc) executed when MailCC var is empty:
<cfif len(trim(MAilCC))>
<cfmail cc="..." ...>
...
</cfmail>
<cfelse>
<cfmail ...><!--- no cc attrib in this one --->
...
</cfmail>
</cfif>
2) use attributeCollection attribute of cfmail tag. assumes you are on
cf8. (or is it only update 1 that allows using attributeCollection
together with in-tag attributes? if so, you have to be on cf8.0.1).
something like:
<cfscript>
mailAttr = {};
mailAttr.server = "mail.somedomain.com";
mailAttr.username = "...";
mailAttr.password = "...";
mailAttr.from = "name@somedomain.com";
mailAttr.subject = "mail subject here";
if (len(trim(MailCC)) gt 0)
mailAttr.cc = "ccname@somedomain.com";
</cfscript>
<cfmail to="..." attributeCollection="#mailAttr#">
...
</cfmail>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181526#M16351
Aug 03, 2008
Aug 03, 2008
Copy link to clipboard
Copied
quote:
Originally posted by: Newsgroup User
I am currently looping over a list of email addresses and sending out the
mail to all users. I'd like to instead check to see if a variable is set,
and add the cc="" in the cfmail tag instead.
When I try this it fails, I simply did a <cfif MailCC neq
"">cc="name@site.com"</cfif> in the cfmail tag, but it doesn't seem to like
this.
Has anyone done anything similar?
Or how can I get this to work?
Thanks!
You can never put one cf tag inside another like this.
<cftag1 <cftag2> </cftag2> >
To get it to work, my approach would be do the if/else stuff in advance and set a variable to either an empty string or "cc='whoever'". Then put that variable into your cfmail tag.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181527#M16352
Aug 03, 2008
Aug 03, 2008
Copy link to clipboard
Copied
Or else,
<cfmail to="email_id_goes_here" from="from_info_goes_here" subject="subject_goes_here" cc="#Iif(IsDefined('your_cc_variable') and len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#">
<cfmail to="email_id_goes_here" from="from_info_goes_here" subject="subject_goes_here" cc="#Iif(IsDefined('your_cc_variable') and len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#">
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181528#M16353
Aug 04, 2008
Aug 04, 2008
Copy link to clipboard
Copied
Ok, I tried:
<cfmail from="info@site.com" to="#mail#"
cc="#iif(isdefined("MailCC"),de("MailCC"),de(""))#" subject="Fencing e-mail
regarding #cReason#" type="html" replyto="#form.contactEmail#">
And it still send to the 1st email only, but not the MailCC.... and I am
manually setting that varialbe, so I know it has a value..........
Why isn't it sending to the MailCC??
"Daverms" <webforumsuser@macromedia.com> wrote in message
news:g763qi$egd$1@forums.macromedia.com...
> Or else,
>
> <cfmail to="email_id_goes_here" from="from_info_goes_here"
> subject="subject_goes_here" cc="#Iif(IsDefined('your_cc_variable') and
> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#">
>
>
>
<cfmail from="info@site.com" to="#mail#"
cc="#iif(isdefined("MailCC"),de("MailCC"),de(""))#" subject="Fencing e-mail
regarding #cReason#" type="html" replyto="#form.contactEmail#">
And it still send to the 1st email only, but not the MailCC.... and I am
manually setting that varialbe, so I know it has a value..........
Why isn't it sending to the MailCC??
"Daverms" <webforumsuser@macromedia.com> wrote in message
news:g763qi$egd$1@forums.macromedia.com...
> Or else,
>
> <cfmail to="email_id_goes_here" from="from_info_goes_here"
> subject="subject_goes_here" cc="#Iif(IsDefined('your_cc_variable') and
> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#">
>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181529#M16354
Aug 04, 2008
Aug 04, 2008
Copy link to clipboard
Copied
Hi Steve,
Couple of questions though,
i) Are you setting the MailCC variable somewhere in your page before the <cfmail> declaration. (Try a cfdump)?..
ii) What do you get when assigning
"#Iif(IsDefined('your_cc_variable') and
> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#" to a variable (using cfset) and printing it?...
Couple of questions though,
i) Are you setting the MailCC variable somewhere in your page before the <cfmail> declaration. (Try a cfdump)?..
ii) What do you get when assigning
"#Iif(IsDefined('your_cc_variable') and
> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#" to a variable (using cfset) and printing it?...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181530#M16355
Aug 05, 2008
Aug 05, 2008
Copy link to clipboard
Copied
"Daverms" <webforumsuser@macromedia.com> wrote in message
news:g78qnf$iac$1@forums.macromedia.com...
> Hi Steve,
>
> Couple of questions though,
>
> i) Are you setting the MailCC variable somewhere in your page before the
> <cfmail> declaration. (Try a cfdump)?..
Yes, I'm manually setting the MailCC variable before the <cfmail> tag.
>
> ii) What do you get when assigning
> "#Iif(IsDefined('your_cc_variable') and
> > len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#" to a variable
> (using cfset) and printing it?...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181531#M16356
Aug 05, 2008
Aug 05, 2008
Copy link to clipboard
Copied
Hi,
Can you please post your code?.
Can you please post your code?.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181532#M16357
Aug 11, 2008
Aug 11, 2008
Copy link to clipboard
Copied
I get the email address that is defined for
'your_cc_variable'
"Daverms" <webforumsuser@macromedia.com> wrote in message
news:g7b0s9$5fk$1@forums.macromedia.com...
> Hi,
>
> What do you get when outputting
>
> "#Iif(IsDefined('your_cc_variable') and
>> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#"
>
"Daverms" <webforumsuser@macromedia.com> wrote in message
news:g7b0s9$5fk$1@forums.macromedia.com...
> Hi,
>
> What do you get when outputting
>
> "#Iif(IsDefined('your_cc_variable') and
>> len(your_cc_variable) gt 0,DE(your_cc_variable),DE(''))#"
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
LATEST
/t5/coldfusion-discussions/cfmail-and-adding-cc-if-needed/m-p/181533#M16358
Aug 12, 2008
Aug 12, 2008
Copy link to clipboard
Copied
Hi,
Can you please be more specific about your last reply?.. Do you mean the solution that I provided you earlier is working?.
quote:
I get the email address that is defined for 'your_cc_variable'
Can you please be more specific about your last reply?.. Do you mean the solution that I provided you earlier is working?.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

