tags:

views:

64

answers:

3

What I have is this:

$SQL = "SELECT * FROM users";
            $query = mysql_query($SQL) OR die(mysql_error());
            $row = mysql_fetch_array($query);
            $implodeEmail = implode(", ", $row['paypal']);
            $mailTo = "noreply@" . $_SERVER['HTTP_HOST'];
            $mailSubject = $bootTitle;
            $mailMessage = $_POST['massemail'];
            $mailHeaders =  "From: noreply@" . $_SERVER['HTTP_HOST'] . "\r\n" .
                            "Reply-To: noreply@" . $_SERVER['HTTP_HOST'] . "\r\n" .
                            "X-Mailer: PHP/" . phpversion() . "\r\n" .
                            "Bcc: " . $implodeEmail;
            if (mail($mailTo, $mailSubject, $mailMessage, $mailHeaders))
            {
                echo "e-Mail successfully sent.";
            }

It successfully sends to the $mailTo, but I want it to Bcc to everyone's paypal email, and that isn't working. I thought about just making all emails visible, but I really don't want that, and I don't want to loop through each one and send out an email for each person.

Ideas/help?

A: 

Try phpMailer or SwiftMailer.

bswietochowski
Link : http://quomon.com/question-How-do-I-set-a-BCC-address-when-sending-email-in-PHP-428.aspx
Jason
+1  A: 

just a rough idea:

$implodeEmail = implode("; ", $row['paypal']);

or just noticed that instead of:

$row = mysql_fetch_array($query);
$implodeEmail = implode(", ", $row['paypal']);

should be:

while($row=mysql_fetch_array($query)) $rows[]=$row['paypal'];
$implodeEmail = implode(", ", $rows);
code90
Whoops, I should have noticed that. Thanks buddy!
Rob
A: 

If you include all the addresses in the Bcc header, the server should send a copy to each one. If he doesn't do that, something is wrong with the server. Look in the php.ini mail config, and test your mailserver. And yeah, you should use ";" instead of "," to implode the addresses.

joni