Title: Message
Not necessarily a fault, but <cfmail> also loops over queries.
Instead of using the cfoutput tag around the cfmail tag, just include a 'query=latetasks' in the cfmail tag.
I'm actually surprised that you didn't get an error saying you couldn't embed the cfmail within the cfoutput query. I'm sure I got an error like that when I tried this years ago.
 
Secondly, if you are defining the 'email' variable outside the loop, then it will only ever send all email to this user. Nothing is every changing what this variable is set to within the loop.
Is there somesort of variable within the query that should define who the email goes to?
Is this where the 'assigned_to' is coming from?
If the 'assigned_to' usernum, the username, and their email address is all stored in a database, you might try joining these tables together so that your query gives you the correct email address, and not just a user number.
 
Hope this helps a bit.
 
Darren Tracey
-----Original Message-----
From: Dean Brandt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 11:28 AM
To: CFAussie Mailing List
Subject: [cfaussie] Missing a loop somewhere

 
    Hi all
 
    I am trying to send an email to the assigned person in a task list using this code:
 
 
<cfoutput query="latetasks">
<cfmail
 From="
taskmanager@domain.com.au"
 Subject="Task is overdue"
 To=#email#>
 The task ID is: #task_id#
 The task description is: #description#
 The task was due for completion on #DateFormat(scheduled_completion, "D MMMM YYYY")#
 Please visit
www.cleverthinking.com.au to update your task.
</cfmail> 
</cfoutput>
 
 
    What is happening is that it sends all emails to one person rather than sending each item to its owner.
 
    #email# is defined by a cfset earlier in the code. ie if a task is assigned to id number 2:
 
<cfif #assigned_to#='2>
<cfset person='username'>
 
then
 
<cfif #person='Joe Blow>
<cfset #email#='[EMAIL PROTECTED]'>
 
 
    Can anyone see any glaring faults with this? Obviously there's at least one :)
 
    Thanks
 

Dean Brandt
Clever Thinking Consulting
Network/Systems Integration,
Application Design
Melbourne, Australia
0418488885
...smart networks for smart business

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to