On 10/1/02, Ryan Sabir penned:
>Thats how CFMAIL is supposed to work when you pass a query to it.
>
>What you should do is use a <CFLOOP query="queryname"> inside your
>CFMAIL content section to output the data you need in the table.
>
>bye!

That depends. If you have a cfouput nested in the cfmail, it 
shouldn't. Or at least it never has in the past.

<CFQUERY DATASOURCE="ezcart_v8_SQL" NAME="getcats">
SELECT category_name
FROM categories
order by category_id
</CFQUERY>

The cfmail below will send an e-mail for each category.

<cfmail query="getcats"
to="[EMAIL PROTECTED]"
from="[EMAIL PROTECTED]"
subject="test query">
#category_name#
</cfmail>

In CF 4.0, 4.5 and 5, the cfmail below will send a single e-mail 
containing all categories.

<cfmail query="getcats"
to="[EMAIL PROTECTED]"
from="[EMAIL PROTECTED]"
subject="test query"><CFOUTPUT>
#category_name#</CFOUTPUT>
</cfmail>

I'm having a similar problem and found the thread started by Srimanta 
while looking to see if anyone else had similar problems. My shopping 
cart sends out an e-mail confirmation based on the shopper's cart 
after an order is placed. The code below (simplified) has worked fine 
for 3 years since version 4.0.

<cfmail query="variables.basket"
to="#customeremail#"
from="#merchantemail#"
subject="#storename# Order Number #Order_ID#">
Thank you for your purchase, order number #Order_ID#.

<CFOUTPUT>Product Name: #Item_Name#
Product ID: #Item_ID#
Item Price: #dollarformat(Item_Price)#
Qty Purchased: #Quantity#
Item Total: #dollarformat(Quantity * Item_Price)#
_______________
</CFOUTPUT>
Total: #dollarformat(Order_Total)#
</cfmail>

Now, with CFMX, if the shopper has 4 items in their basket it sends 
out 4 e-mails.

1st mail contains 1st item
2nd mail contains 1st 2 items
3rd mail contains 1st 3 items
4th mail contains all 4 items correctly.

<RANT>
Now, I love CF, but I'm really getting sick of going back to every 
application I've built to fix things every time a new version of CF 
comes out, and having to write the same code 3 and 4 different ways 
with a version switch so the proper code loads depending upon the 
version of CF that's running when building a new app. One of the 
advantages of using CF has always been quicker development time. That 
advantage is quickly defeated when I have to write the same code 3 
times so my program will run on 4.0, 4.5, 5 and MX.

Examples:
1) cflock. Have to place a version switch in every application, then 
cfinclude 2 different sets of files for every session, server and 
application variable written and read. One using "name" for 4.0, one 
using "scope" for 4.5 and higher. How I would have done it? Write 4.5 
and higher so if name and scope were both included, name would be 
ignored. Issue a patch for 4.0 so including scope wouldn't throw an 
error.

2) cfmail. Have to place a version switch in every application, then 
cfinclude 2 different sets of files for every cfmail containing 
cfoutput. One with cfprocessingdirective suppresswhitespace="no" for 
4.5 and higher, one without for 4.0. I NEVER had a problem with 
excess white space in cfmail using 4.0. How I would have done it? The 
automatic white space cleanup would have been written to leave cfmail 
alone. Then we would could add suppresswhitespace="yes" if need be. 
Either that or issue a patch for 4.0 where using 
cfprocessingdirective wouldn't throw an error.

3) cfhttp POST. Have to place a version switch every time I use 
cfhttp, then manually URLEncode any variables that should be encoded 
in 4.5 and earlier, which is fine and the way it should be. But now I 
have to go back and set all URLEncoded variables outside of the 
chfhttp tag, and either encode them for version 4.5 and earlier, or 
pass them as they are form 5 and later. Still haven't figured out 
what to do in 5 and higher when you don't WANT to send the value 
encoded. How I would have done it? Just leave the darned thing the 
way it was. That's why they made URLEncodedFormat() in the first 
place. Let they developers decide if we want to encode the values.

4) Grouped queries. They totally changed the way currentrow is 
calculated on grouped queries. I wrote a little tag that let's you do 
Next'n records on a grouped cfoutput. CFMX totally broke it and I had 
to put a version switch in it. Again, I would have left this alone.

5) Now this new one. I'll have to go back and add a THIRD cfinclude 
just to use cfmail with a query and nested cfoutput.

And I'm just beginning to test things with CFMX. I can only imagine 
what other problems I'll run into. Utterly ridiculous!
</RANT>

Sorry about the rant. It's early and I hate finding new bugs first 
thing in the morning. :)
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to