user1250526
user1250526

Reputation: 309

PHP Getting a script together which will send a newsletter to all emails in database

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

Answers (1)

Travesty3
Travesty3

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

Related Questions