Your template has to use <CFLOOP> instead of <CFOUTPUT>:

<cfquery name="Recordset1" datasource=#dsn#>
SELECT * FROM dbo.Customers
</cfquery>
<cfmail to="#recordset1.email#"
from="[EMAIL PROTECTED]"
subject="your order sir"
type="html"
>
Hello #recordset1.name#
<CFINCLUDE TEMPLATE="mytemp.cfm"
</cfmail>

and on mytemp.cfm

<cfquery name="Recordset2" datasource=#dsn#>
SELECT * FROM dbo.Customers
</cfquery>
Here is your order dude:
<cfloop query="recordset2">
#Recordset2.orderdetail#<br>
</cfloop>

tom


"Nick Texidor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks Tom... I hadn't thought of using CFInclude... Trouble is, I want
the
> included file to process the queries!!   And that bit doesn't work.  I
have
> a page that when displayed is the newsletter I want to send... I also want
> to use the same page to send to subscribers... It's the queries that are
> causing me the problems!  :^)
>
>
> on 29/8/01 10:48 AM, tom muck at [EMAIL PROTECTED] wrote:
>
> > That's not a problem.  Have you tried it?  You can't use a query
attribute
> > of <CFMAIL> tag if you do it that way, but you can use a <CFLOOP> and
send
> > one <CFMAIL> at a time.  It's actually just as fast.  I always use a
> > <CFINCLUDE> to include the coldfusion page as the body.
> >
> > tom
> >
> > "Nick Texidor" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> Iım trying to send an HTML newsletter via the CFMAIL tag but am having
a
> > few
> >> problems.
> >>
> >> If I simply enter all the HTML code in the tag, it works ok.  But Iıd
like
> >> to use an existing CF page, so that all the Queries run and then send
the
> >> resulting content.  Can this be done, or would I need to embed all the
> > HTML
> >> code from the template into the CFMail tag.
> >>
> >> Should I maybe use CFHTTP to run that newsletter.cfm page to allow all
the
> >> queries to process, and then send the resulting output??
> >>
> >> Thanks for any help/suggestions
> >>
> >> N
> >>
> >>
> >>
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to