Title: Message
That's what we do. If you have a discrete list of variables, loop through the list of variables, replacing them with their values. Theoretically, you could also save it to file and include using save content, although I don't think it'd be a great idea. If you do change to looping through and ReplaceNoCase ing, it'd be interesting to see hopw performance compared to Evaluate(DE(x)) as I'd imagine the replace could get pretty slow as the length of the variable list grows.
 
Does anyone have a more elegant/performant solution?
 
Best Wishes,
Peter
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Blair McKenzie
Sent: Thursday, June 08, 2006 6:14 AM
To: CFCDev@cfczone.org
Subject: Re: [CFCDev] Avoiding Evaluate While Using CFMAIL

You could just treat it like a template with fields that need to be replace()'ed.

Blair

On 6/8/06, Seth MacPherson < [EMAIL PROTECTED]> 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

----------------------------------------------------------
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
----------------------------------------------------------
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