Hello all,
I am in the process of putting together an e-mail newsletter (using CFMAIL),
and everything is working fine except that each email address is receiving
TWO emails instead of one. Obviously this is not going to make for happy
recipients :) Can anybody see (from the code below) why I am generating
duplicate emails?
Cheers,
David
---------------------------------------------------------------------
<cfset TestDate = CreateODBCDate(Now())>
<cfset yesterday = '#DateAdd("d",-1,"#TestDate#")#'>
<cfquery name="email_address" datasource="dsn"
cachedwithin="#CreateTimeSpan(0,23,0,0)#">
SELECT email
FROM users
</cfquery>
<cfquery name="articles" datasource="dsn"
cachedwithin="#CreateTimeSpan(0,23,0,0)#">
SELECT *
FROM world_news
WHERE date_entered >= #yesterday#
AND date_entered < #TestDate#
ORDER BY news_date DESC
</cfquery>
<cfif articles.RecordCount GT 0>
<cfloop query="email_address">
<cfmail to="#email_address.email#"
from="[EMAIL PROTECTED]>"
subject="Daily News"
server="home.com"
port="25"
type="HTML">
<!---
beginning of email content here
--->
<cfloop query="articles">
<!---
Looping through the news articles...
--->
</cfloop>
</cfmail>
</cfloop>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists