Hi Paul,
Thanks`-` I will try this when I get home from school. I tried to set things up 
at school, but PhpMyadmin would not play nice with me:( I use Navicat at home. 
I never thought it would so hard to add a couple rows of data, I really hate 
that admin!

I see that using both the cfloop & the query information would cause confusion 
with the cfmail.
I will let you know tomorrow how things worked out.
Thanks again for your help,
John

 




________________________________
From: Paul Kukiel <[email protected]>
To: cf-newbie <[email protected]>
Sent: Wednesday, January 21, 2009 4:53:35 AM
Subject: RE: cfmail& query users

Hi John,


Use <cfloop /> or the query attribute in cfmail but not both.

ie
<!---send emails--->
<cfquery datasource="my_DSN" name="GetUsers">
  select emailaddress, firstname
  from emails
</cfquery>

<cfloop query="GetUsers">
<cfmail to="#GetUsers.emailaddress#"
    from="[email protected]"
    subject="Hello From Got Nutrients?"
    type="HTML">
    Dear #GetUsers.firstname#<br />

    We, here at Got Nutrients?, would like to thank you for joining.<br
/>

    Best wishes
    John
</cfmail>
</cfloop>

Or

<cfmail to="#GetUsers.emailaddress#"
    from="[email protected]"
    subject="Hello From Got Nutrients?"
    type="HTML" query="GetUsers">
    Dear #GetUsers.firstname#<br />

    We, here at Got Nutrients?, would like to thank you for joining.<br
/>

    Best wishes
    John
</cfmail>

<cfmail /> with query is less code but always looks to me likes its sending
just a single email so I use the <cfloop method>


Paul.


-----Original Message-----
From: John Barrett [mailto:[email protected]] 
Sent: Wednesday, 21 January 2009 2:24 AM
To: cf-newbie
Subject: cfmail& query users

Did I do something really wrong here?
I am using cfmail to query a database to send a welcome mail for users in
the database. Instead of looping through the database, it takes the first
filed and sends that for the number of users in there. There are 3 so if I
run the code I get 3 mails in one account,and not the one in the 3 mail
accounts.

<!---send emails--->
<cfquery datasource="my_DSN" name="GetUsers">
  select emailaddress, firstname
  from emails
</cfquery>


<cfloop query="GetUsers">
<cfmail to="#emailaddress#"
    from="[email protected]"
    subject="Hello From Got Nutrients?"
    type="HTML"
    query="GetUsers">
    Dear #GetUsers.firstname#<br />

    We, here at Got Nutrients?, would like to thank you for joining.<br
/>

    Best wishes
    John
</cfmail>
</cfloop>







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4307
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to