Page 1 of 1

Mail list out of addresses in DB

Posted: Sun Feb 07, 2010 8:52 am
by synical21
Is it possible to grab every users email from the database, then create a mailing list with them?

Re: Mail list out of addresses in DB

Posted: Sun Feb 07, 2010 9:57 am
by Grizzzzzzzzzz
yes

Re: Mail list out of addresses in DB

Posted: Sun Feb 07, 2010 12:22 pm
by synical21
Any chance you could extend that answer? :P

Re: Mail list out of addresses in DB

Posted: Sun Feb 07, 2010 12:26 pm
by limitdesigns
You could make a form for administrators for a message to be sent to all users, and then you can get all user rows in a while loop and send an email with the content of that form to each user's email address.

Code: Select all

 
<?php
$message = $_POST['message'];
$from_header = "From: you@yourdomain.com";
$subject = "Newsletter";
$result = mysql_query("SELECT `email` FROM `users`");
while($row = mysql_fetch_array($result)) {
     mail($row['email'], $subject, $message, $from_header);
}
?>
 

Re: Mail list out of addresses in DB

Posted: Sun Feb 07, 2010 12:52 pm
by synical21
Oooo of course so simple, i will try that now