Jump to content

Php Mail BCC.


whelpton

Recommended Posts

I am trying to mail all my users, I've just managed to cobble together the code from various sources, many of them on here and I thank everyone whos helped me.

 

Trouble I'm having at the moment is that, obviously I cant have my users knowing each others email addresses, so I am trying to use BCC to send the mail, but it just isnt working so far. This is the code that Ive got.

 

ini_set('sendmail_from', 'unmanned@alportstudios.co.uk'); //Suggested by "Some Guy"
$subject = trim(addslashes($_POST['Subject']));
$mail_body = trim(addslashes($_POST['Message']));
$headers = 'From: unmanned@alportstudios.co.uk' . "\r\n" .
    'Reply-To: unmanned@alportstudios.co.uk' . "\r\n" .
    'X-Mailer: PHP/' . phpversion(); 
//$headers .= 'Bcc:' $recipient . "\r\n";	
$email = "unmanned@alportstudios.co.uk"; //senders e-mail adress 

$result = mysql_query("SELECT DISTINCT Email FROM Users") or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
    $recipient .= "$row[0], ";
//$recipient = "littlequahog@hotmail.com";
   }
$headers.="Bcc:";
$headers.= $recipient; 

mail('littlequahog@hotmail.com',$subject, $mail_body, $headers,);
echo 'Sucessfully sent emails to:';
echo $recipient;
echo '<br><a href="index.php">Continue</a>';
?>

 

In case you were wondering, the

mail('littlequahog@hotmail.com'

is so that I allways recieve a copy of all the messages being sent out.

 

Cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.