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!

cfoutput nesting in cfmail

Status
Not open for further replies.

doyle9732

Programmer
Apr 12, 2002
185
CA
I am trying to send out cfmail notification with query results in the mail....but get the following error:

Invalid tag nesting configuration

A query driven CFOUTPUT tag is nested inside a CFMAIL tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing.

Scenario: Purchase order system....the user is getting email notifying that their manager has approved their order and I want to list just the items they ordered. If I have the cfmail query based on this query, it will produce how ever many emails as items....which wouldn't be appreciated!

Here's a snippet of the code:

<cfmail to=&quot;#getOrderInfo.RequestedByEmail#&quot; from=&quot;#ManagerEmail#&quot; subject=&quot;Purchase Order Request - Approved&quot; server=&quot;xxxx.xxx.xxx.xxx&quot; port=25 type=&quot;HTML&quot;>

#attributes.ManagerName# has approved your Purchase Order <cfif POType is &quot;LV&quot;>(#PONum#) </cfif>as of #today#.
<p>
It included the following items<p></p>
<cfoutput query=&quot;yourOrder&quot;>#description#<br> </cfoutput><p></p>

Any suggestions?

Stephanie
 
what if you use the CFOUTPUT to build a String just before you enter the CFMAIL tag...

<CFSET txtYourItems =&quot;&quot;>
<CFOUTPUT query=&quot;yourOrder&quot;>
<CFSET txtYourItems=txtYourItems & #description# & &quot;<br>&quot; >
</CFOUTPUT>

Then in your CFMAIL tag just
It included the following items<p></p>
txtYourItems
<p></p>

Give it a try.

 
You'll need to use a cfloop instead of a cfoutput in the body of your cfmail tag. The cfmail tag acts as a cfoutput tag, which is why you can't nest the cfoutput inside the cfmail tag.
Code:
<cfloop query=&quot;yourOrder&quot;>#description#<br> </cfloop>
Another option is to output the query before the cfmail and save it to a variable, or better yet, output the query just like you were in the cfmail, but before the cfmail tag, and wrap it with cfsavecontent, which will allow you to save anything in between the cfsavecontent opening and closing tags to a variable you specify.

-Tek
 
:~/

colour me red, as in EMBARRASSED!!!

Here I am trying to work around this, running in circles, when the answer was simple....and certainly within my grasp of knowledge.

Needless to say, it worked like a charm.

thank you!
Stephanie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top