0

I have about 50 users in a database and I want to send them a newsletter.

$result = mysql_query("SELECT email FROM users") or die(mysql_error());  
$row = mysql_fetch_array( $result ); // had 50 emails

How do I put the $row['email'] into the mail code below.

$m->setBcc(Array("[email protected]", "[email protected]","[email protected]"));

Let me know.

1
  • I hope this is not a product quality code you are writing.. sending newsletters via bcc will give you no possibility to track which mails were sent successfully(what are you doing, if your script timeout?).. use pear::Mail_Queue instead.. Commented Jul 13, 2010 at 0:16

1 Answer 1

2
$recipients = array();

while($row=mysql_fetch_array($result))
{
 $recipients[] = $row['email'];
}

$m->setBcc($recipients);

tell me if it doesn't work and I'll immediately delete it :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.