I am experiencing an issue where
I query a SQL database for a record
set of about 1300 and then send out
an email to each address on the list
and one to myself.

I use

<cfloop query="thequery">

to loop over the result set
and then an inner loop to
send each email to the email in the
recordset and to me.
<cfloop list="[EMAIL PROTECTED],#thequery.email#" delimiters=",">

I then put in my
cfmail tag...
What happens is that instead of sending out
1300 emails It seems to duplicate the
entire list repeatedly.  I finally
stopped when the SPOOL directory hit 15000
emails.

I tested the query and nested loops by
remming out the <CFMAIL> in its entirety
and adding a couple of counters to see if
the loops were replicating, but they weren't.

anyhow.  any help would be appreciated.
I have enclosed the code.

-----------Code Starts Here-----------

<cfquery name="qryEmailList" datasource="DSN_EpicResorts">
        SELECT [key] as Seed, FirstName, LastName, Address, City, State, Zip,
EmailAddress
        FROM [dbo].[EmailListBase]
        ORDER BY [key]
</cfquery>



<cfset count1 = 0>
<cfset count2 = 0>

<cfloop query="qryEmailList">

<cfset count1 = count1 + 1>

<cfoutput>#count1#</cfoutput>

<!-- Send User Invite email for EmailList -->
<cfloop INDEX="ListElement" LIST="[EMAIL PROTECTED]" delimiters=",">

<cfset count2 = count2 + 1>
<cfoutput>#count2#</cfoutput>


<cfmail to="#ListElement#" from="[EMAIL PROTECTED]" subject="EmailList"
server="smtp.mailserver.net">
                This newsletter is never sent unsolicited.
                You are receiving this e-mail because you
                signed up for the  e-mail newsletter.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To unsubscribe, send a message to [EMAIL PROTECTED] with 
'unsubscribe' in the body or visit the list page at www.houseoffusion.com

Reply via email to