Title: Message
Right, but what if you have a customizable template which admins (without programming skills, but with the ability to type simple variable names) want to be able to edit?
 
Imagine a form with a WYSIWYG editor and telling site admins to "just type #LastName#" where you want their last name to go and providing a list of variables and validation to make sure you only put in correct variable names. We use %LastName% as our string, but that was the use case we had so end users could put whatever variables wherever in a nicely formatted HTML email they could design themselves and then send to n-recipients.
 
Best solution we came up with was the ReplaceNoCase, but to be fair, we don't have anyone using the personalized email feature, so we haven't thought about it very much :->

Best WIshes,
Peter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nando
Sent: Thursday, June 08, 2006 7:45 AM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Avoiding Evaluate While Using CFMAIL

Why can't you simply put the email tag in a loop and place your variables directly in the cfmail tag? I can't tell from your example where those variables are coming from, but it seems from the recipients query. Would that work for you?


<cfset var campaign = GetCampaign() />

<cfloop query="recipients">

<cfmail

to="#recipients.email#"

      from="#Campaign.GetEmailFrom()# (#Campaign.GetEmailFromAlias()#)"

      subject="Campaign ## #campaign.GetCampaignID()#"

      failto="#Campaign.GetEmailFailTo()#"

      mailerid="Summit Projects, Inc. "

type="HTML">

#Email#

#FirstName#

#LastName#

</cfmail>
<cfloop>


Seth MacPherson wrote:

Hello all,

I have some code that sends email to a list of recipients but I’m having trouble and I’d love some advice.

<cfset var campaign = GetCampaign() />

<cfmail query="recipients"

to="#recipients.email#"

      from="#Campaign.GetEmailFrom()# (#Campaign.GetEmailFromAlias()#)"

      subject="Campaign ## #campaign.GetCampaignID()#"

      failto="#Campaign.GetEmailFailTo()#"

      mailerid="Summit Projects, Inc. "

type="HTML">

#HTMLBody#

</cfmail>

When I execute the (above) code it works, sort of.  It sends email just as expected except for one thing, the message looks like this (forgive the lame content – it’s just test material)

BEGIN CUSTOM FIELDS
#Email#

#FirstName#

#LastName#

#CompanyName#

#AddressLine1#

#AddressLine2#

#AddressLine3#

#City#

#StateProvince#

#PostalCode#

#Country#

#MailFormat#

#BLAMMO#

#CRAMMO#

#FLAMMO#

#SLAMMO#

#WHAMMO#

As you might have guessed, the fields above are all variables that need to be populated from the query but are actually the content of the HTMLBody variable.  After fooling around with it for a while I found that using Evaluate(DE(HTMLBody)) properly replaces the CF variables with the appropriate query data.  Good grief.  I hate using Evaluate, let alone Evaluate coupled with DE. 

Can I get some advice on how I could avoid using either Evaluate, DE, or both altogether?

Thanks in advance.

I shiny bottle of beer at CFUnited to the person who tackles the beast.

Seth MacPherson
Application Developer
101.5 OAK STREET
HOOD RIVER
, OR 97031 
541.387.8883x246 (w)
360.241.8329        (c)

[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org


--


Aria Media Sagl
CP 234
6934 Bioggio
Switzerland
www.aria-media.com


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

Reply via email to