I am creating an alert feature for my visitors so they can signup for an alert when a used car comes available within their metro area.
Once a morning I would schedule a cfm page to run that would send out all the alerts for those who signed up for alerts for cars that were entered the previous day.
My question is what happens let's say if there were 10 new car listings from the day before for the same metro area?
I would like to place all of those new listings within one email for the person who signed up for the alert instead of sending 10 individual emails to one person.
If I query my listings table for yesterday's new cars and JOIN it with the Alerts table where the metro area is equal can I loop the 10 new listings within the CFMail?
Can you place a loop within a CFMail tag?
Once a morning I would schedule a cfm page to run that would send out all the alerts for those who signed up for alerts for cars that were entered the previous day.
My question is what happens let's say if there were 10 new car listings from the day before for the same metro area?
I would like to place all of those new listings within one email for the person who signed up for the alert instead of sending 10 individual emails to one person.
If I query my listings table for yesterday's new cars and JOIN it with the Alerts table where the metro area is equal can I loop the 10 new listings within the CFMail?
Can you place a loop within a CFMail tag?
Code:
<cfquery name="GetNewAds" datasource="#DSN#">
SELECT *
FROM Listing INNER JOIN Alerts ON Listing.metroFk = Alerts.metroFk
WHERE beginDate = #yesterday#
</cfquery>
<CFLOOP QUERY="GetNewAds">
<CFMAIL To="#GetNewAds.email#"
From="<support@example.com>"
Subject="Notification of new ad(s)"
server="mail.example.com">
Ads that were posted yesterday for the #GetNewAds.metroFk# metro area:
<-- how do I loop the results for the 10 new cars here? -->
#GetNewAds.carType#, #GetNewAds.address#, #GetNewAds.carCost#
Thanks
</CFMAIL>
</CFLOOP>