Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Location
    Vermont
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Different automated emails send with same email information

    Problem:
    This file is for automated email reminders. The emails are called by "template." It loops through the active emails. For each email it pulls a different set of email addressed with "getAddress." Here is the part I haven't been able to figure out; On screen (see image below) it appears that the emails pulled the proper data, and email lists. The emails right now are all directed at me, and I even get the proper number, including the correct "to" email addresses, of emails BUT the emails all have the email info (from, subject, body) as the first email in the loop.

    Below is the code (from, to, etc. are hard coded for the time being), and a screen shot of the results (browser side.)

    Any suggestions would be greatly appreciated! Thanks!


    Code:
    <cfloop query="template">
    <cfset getAddress=getNonActivatedGreenKeys(#template.accountList#, "", "", #template.issuedDays#)>
    <cfif debugmode>
    	<cfmail
    		query="getAddress"
    		server="#BG_MAIL_SERVER#"
    		from="#template.from#" 
    		to=""
    		bcc=""
    		replyto=""
    		subject="#template.subject#" 
    		spoolEnable="yes">#getAddress.issuedToEmail# #template.body#</cfmail>
    <cfelse>
    	<cfmail
    		query="getAddress"
    		server="#BG_MAIL_SERVER#"
    		from="#template.from#" 
    		to=""
    		bcc=""
    		replyto=""
    		subject="#template.subject#" 
    		spoolEnable="yes">#template.body#</cfmail>
    </cfif><!--- closes debugmode if --->
    <div style="background-color: #FFFFFF; border: 2px solid #000000; padding: 10px; margin-bottom:15px;">
    <p>
    <b>Email Sent to <cfoutput>#getAddress.recordCount#</cfoutput> Recipients</b><br />
    <cfoutput>
    Name: #template.name#<br />
    From: #template.from#<br />
    Subject: #template.subject#<br />
    Body: #template.body#<br />
    </cfoutput>
    </p>
    </div>
    </cfloop><!--- closes template query --->


  • #2
    New to the CF scene
    Join Date
    Mar 2007
    Location
    Vermont
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up fixed...

    My boss was able to figure it out (yey bosses!) There is a bug in CF 7 that causes the inside loop (<cfmail query="">) to not update the next time through the outside loop. The outside loop worked fine, which is why on screen, it appeared fine.

    To fix it I had to change #template.body# to #template.body[template.currentrow]# anywhere template was being used inside the cfmail tags, setting up an array to pull the correct data from the template loop.

    Cheers!
    Phil
    "everything should be made as simple as possible, but not simpler." - albert einstein


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •