Question
CFMAIL Looping
I have an application that I've written so that a user can
send a group of people an email message. It is in two parts, the
form and the action page that actually sends the email. The first
page's code is as follows:
<cfquery name="getEmail" datasource="#application.dsn#">
SELECT *
FROM tblEpolarityRPP_new
ORDER BY EMAIL
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Email RPPs</title>
<link rel="stylesheet" type="text/css" href="organized.css">
</head>
<body>
<h2>Email RPPs</h2>
<cfform action="rppemail_actiontest.cfm" method="post">
<cfoutput query="getEmail">
<!--- #getEmail.Email#<br> --->
<input type="hidden" name="Email" value="#getEmail.Email#">
</cfoutput>
<p class="p5">Enter message here:<br>
<textarea name="Message" rows="20" cols="50"></textarea><p>
<input type="submit" value="Send Email"> <input type="reset" value="Clear Form">
</cfform>
</body>
</html>
The query retrieves about 710 email addresses from the table. When we submit, it apparently works okay, but according to the host of our web site, there are too many email addresses in the list and it doesn't send any because it hangs. I know that what the action page is doing is creating an email with 710 email addresses in the "TO" line. What I would like it to do is create 710 different emails, with one of the email addresses from the database in each message. According to the tech support person at the hosting site, this should fix the problem. The code on the action page is:
<cfmail to="#Form.Email#" from="rschwalm@polarityinbalance.com" subject="ePolarity" type="html" server="mail.polarityinbalance.com">
#Form.Message#
</cfmail>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Email RPP Results</title>
</head>
<body>
Your email was successfully transmitted.<p>
<a href="polarityadminindex.cfm">Click here</a> to return to the Administrator menu.
</body>
</html>
Any suggestions on how to create a loop to insert one email address at a time into the email would be greatly appreciated.
Thanks so much,
Michelle Craig
<cfquery name="getEmail" datasource="#application.dsn#">
SELECT *
FROM tblEpolarityRPP_new
ORDER BY EMAIL
</cfquery>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Email RPPs</title>
<link rel="stylesheet" type="text/css" href="organized.css">
</head>
<body>
<h2>Email RPPs</h2>
<cfform action="rppemail_actiontest.cfm" method="post">
<cfoutput query="getEmail">
<!--- #getEmail.Email#<br> --->
<input type="hidden" name="Email" value="#getEmail.Email#">
</cfoutput>
<p class="p5">Enter message here:<br>
<textarea name="Message" rows="20" cols="50"></textarea><p>
<input type="submit" value="Send Email"> <input type="reset" value="Clear Form">
</cfform>
</body>
</html>
The query retrieves about 710 email addresses from the table. When we submit, it apparently works okay, but according to the host of our web site, there are too many email addresses in the list and it doesn't send any because it hangs. I know that what the action page is doing is creating an email with 710 email addresses in the "TO" line. What I would like it to do is create 710 different emails, with one of the email addresses from the database in each message. According to the tech support person at the hosting site, this should fix the problem. The code on the action page is:
<cfmail to="#Form.Email#" from="rschwalm@polarityinbalance.com" subject="ePolarity" type="html" server="mail.polarityinbalance.com">
#Form.Message#
</cfmail>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Email RPP Results</title>
</head>
<body>
Your email was successfully transmitted.<p>
<a href="polarityadminindex.cfm">Click here</a> to return to the Administrator menu.
</body>
</html>
Any suggestions on how to create a loop to insert one email address at a time into the email would be greatly appreciated.
Thanks so much,
Michelle Craig