or use the cfmail query attribute?

On 08/06/06, Nando <[EMAIL PROTECTED]> wrote:
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






--
Nick Tong

web:         http://talkwebsolutions.co.uk
blog:         http://succor.co.uk
short urls: http://wapurl.co.uk
linkedin:    http://linkedin.com/pub/0/a70/502 ----------------------------------------------------------
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