• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

variable in a variable

LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

I am attempting to create a bulk mailer for my law school. The user can
create a newsletter and upload a csv for a temporary dataset to populate the
email addresses on the loop. I would also like it so that they can include
the name of the person they are mailing by inserting a simple 'word'
(#name#).

They first create and save the newsletter. Then they can create a new
campaign by entering the email subject and choose thier newsletter from a
populated list. They also browser for the csv for upload and click continue

The csv is converted to a dataset and weighed against an optout database to
produce a final list of acceptable email addresses. They click send and away
they all go.

I told you all that to ask you all this:

How can I merge the coldfusion ## to grab the persons name during the
mailing? Can it be saved in the html text of the email and then, when looped
and mailed, it can populate that with the name field of the dataset?

When I tried, I got : Dear #name#

I have manually text I entered into the email at the bottom (the optout) and
it merges fine, just not the newsletter itself (#campaign.html#).

Is there anyway to have coldfusion evaluate the variables inside of another
variable after that is evaluated?

<cfloop query="mailist">
<cfmail from="#campaign.emailfrom#" to="#mailist.email#"
failto="bounce@avemarialaw.edu" replyto="#campaign.emailreply#"
server="****" subject="#campaign.subject#">
<cfoutput>#campaign.html#<br /><br />
Your name has been provided to Ave Maria School of Law by the Law School
Admissions Council Candidate Referral Service.<br />If you wish not to
receive future communications, <a
href=" http://www.avemarialaw.edu/mailings/optout.cfm?email=#mailist.email#&name=#mailist.name#">please
click here.</a></cfoutput>
</cfmail>
</cfloop>


TOPICS
Advanced techniques

Views

446

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

Hi

to do this try with Evaluate function.

<Cfset myWelcome="Welcome">
<Cfset wc="myWelcome">
<cfoutput>#evaluate(wc)# To Sai #now()#</cfoutput>
will display :
Welcome To Sai {ts '2006-10-10 17:54:39'}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

I tried the evaluate function and I got this error:
ColdFusion was looking at the following text:
<
The CFML compiler was processing:
< marks the beginning of a ColdFusion tag.Did you mean LT or LTE?

Your example worked fine..... Did I do something wrong?


Here is what I have:
<cfloop query="mailist">
<cfmail from="#campaign.emailfrom#" to="#mailist.email#"
failto="bounce@avemarialaw.edu" replyto="#campaign.emailreply#"
server="****" subject="#campaign.subject#">

<cfoutput>#evaluate(Campaign.html)# <br /><br />
Your name has been provided to Ave Maria School of Law by the Law School
Admissions Council Candidate Referral Service.<br />If you wish not to
receive future communications, <a
href=" http://www.avemarialaw.edu/mailings/optout.cfm?email=#mailist.email#&name=#mailist.name#">please
click here.</a></cfoutput>
</cfmail>
</cfloop>




Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

I think the problem is that when it is evaluating the html, it is getting
errors from the html markup itself.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

> <cfoutput>#evaluate(Campaign.html)# <br /><br />

> I tried the evaluate function and I got this error:
> ColdFusion was looking at the following text:
> <
> The CFML compiler was processing:
> < marks the beginning of a ColdFusion tag.Did you mean LT or LTE?
>
evaluate() treats its argument as an expression; obviously your HTML is not
"an expression"; you only want parts of it evaluated (for all intents and
purposes).

Have a look at
http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000458.htm, and note
in the example @ the bottom how they're using DE() in conjunction with
evaluate().

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

You may need to create your own custom evaluate type function utilizing
replace() or rereplace().

Something like #replace(emailHTML,"#name#",nameVar,"ALL")#

I would suspect for you application developing this into an UDF will
allow you to reuse the replace code for several variables.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2006 Oct 10, 2006

Copy link to clipboard

Copied

LATEST
Thanks Ian, that worked.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation