Reputation: 309
I have got a database with some emails (max 300) and I want to be able to send an newsletter/email to those, the email/newsletter is written in text a form which on submit takes the action through to sendemails.php, but how do I get sendemails.php to send the input of that textarea to send it to all the emails in the database?
Upvotes: 0
Views: 1952
Reputation: 14479
$result = mysql_query("SELECT email FROM member");
$emails = array();
while ($row = mysql_fetch_row($result))
$emails[] = $row[0];
$to = implode(", ", $emails);
mail($to, "subject", $_POST["myTextarea"]);
Upvotes: 1