Mail list out of addresses in DB
Moderator: General Moderators
Mail list out of addresses in DB
Is it possible to grab every users email from the database, then create a mailing list with them?
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: Mail list out of addresses in DB
Any chance you could extend that answer? 
-
limitdesigns
- Forum Commoner
- Posts: 25
- Joined: Sat Feb 06, 2010 9:05 pm
Re: Mail list out of addresses in DB
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
Oooo of course so simple, i will try that now