Jump to content

sending mail to multiple recipients from a db


ccpokerd
 Share

Recommended Posts

Hi again all,Ok, so I have my form all nice and set up, it validates their name and email, sends them a confirmation email and then adds them into a database.Now, i have a form set up (with a nice WYSIWYG editor to send mail to everyone on the list...so far my code is:

<?phprequire("auth.php");require_once("../includes/dbconnect.inc.php");$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);if(!$link) {	die('Failed to connect to database: ' . mysql_error());}$db = mysql_select_db(DB_DATABASE);if(!$db) {	die("Unable to select database");}$qry = "SELECT email FROM signups"$result = mysql_query($qry) or die(mysql_error());											?>

I have no idea where to go from here. :SI assume I have to do something like

foreach(mysql_num_rows($result)) {$to .= $result['email'];$name = $result['name'];

but to be honest I have no idea where to go from here,all I'm asking is for a nudge in the right direction, not a fully-featured script :)Much appreciated

Link to comment
Share on other sites

Yeah, you need to loop through everything and either add every address to the CC line or send one email per address. If you've got a lot of users (more than a thousand) you're going to need to have a queue so that you don't bomb the mail server with a ton of mails at once.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...