Sounds like you don't want to use a query with the cfmail (which specifies
"who" to send the email body to rather than what to send to a single person)
but rather nest a CFLOOP QUERY="" inside your body...
<CFMAIL FROM="x" TO="y" SUBJECT="Foo">
<table width="400">
<tr><td>Item</td><td>Publication</td></tr>
<CFLOOP QUERY="GetPubs">
<tr><td>#Item_id#</td><td>#Headline#"td></tr>
</CFLOOP>
</table>
</CFMAIL>
Think about it, if you substitued CFMAIL for CFOUTPUT (as that's the way you
thought it worked) would you get the output you want ? No you'd get
something like
Item Publication
1 Foo
Item Publication
2 Blah
Item Publication
3 Narf
etc...
you need to loop -inside- the table -after- the header row to get the
correct output.
----- Original Message -----
From: "Tristram Charnley" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, March 23, 2002 3:58 AM
Subject: cfmail query acting strange
> I always thought cfmail with the query attribute acted like <cfoutput
> query...> What am I doing wrong all of a sudden? CFMAIL is sending
multiple
> separate emails, one for each record in the query, rather than multiple
> records in the one email.
>
> Whats happened?
>
> <cfquery name="GetPubs" datasource="#variables.database#">
> SELECT item_Id,Headline
> FROM Publications
> WHERE Item_ID IN (#form.item_id#)
> Order By Item_ID
> </cfquery>
>
> <cfmail to="x"
> from="y"
> subject="Publication request"
> query="GetPubs"
> type="HTML">
>
> <table width="400">
> <tr><td>Item</td><td>Publication</td></tr>
>
> <tr><td>#Item_id#</td><td>#Headline#"td></tr>
>
> etc etc
> </table>
> </cfmail>
>
> Tristram Charnley
> ---------------------------
> [EMAIL PROTECTED]
> Allaire Certified ColdFusion Developer
>
>
>
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists