Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a message using CFSET for CFMAIL

Status
Not open for further replies.

khurram

IS-IT--Management
Jan 10, 2001
95
CA
I am using CFSET to build up an email message with info like billing, shipping, items bought, etc. Since there are several queries involved, I thought it would be easier than trying to make one big query and using with CFMAIL.

However, I keep getting errors when I try to run CFLOOP or CFOUTPUT inside CFSET. I have to be able to output several itmes such as items bought etc but I am not sure how I can continue to build up the message without using loop or output.

Any suggestions?
 
HI,

Is there a reason not to put the <CFOUTPUT>s and <CFLOOP>s right in the Email? I'm not so clear what the problem is. <CFMAIL> will send everything between the tags no matter how many Queries you've output.
For instance:
If you had 3 Queries called First , Second, and Third

<CFMAIL To=&quot;someone@some.domain&quot;
From=&quot;me@mydomain.com&quot;
Subject=&quot;Sample&quot;>

<CFOUTPUT query=&quot;First&quot;>
#Var1#, #Second.Var2[CurrentRow]#, #Third.var3[CurrentRow]#
</CFOUTPUT>

</CFMAIL>

Otherwise if you just have to put them all together with <CFSET> try this:

<CFLOOP from=&quot;1&quot; to=&quot;#First.RecordCount#&quot; index=&quot;x&quot;>
<CFSET EmailContent = &quot;#EmailContent#&quot; & &quot;#First.Var1#&quot; & &quot;#Second.Var2[x]#&quot; & &quot;#Third.var3[x]#&quot;>
</CFLOOP>

This is of course assuming that the 3 queries all have the same number of rows.
Let me know if this helps. If it doesn't then try posting some of your code so I can understand better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top