Page 1 of 1

bcc emails

Posted: Wed Mar 25, 2009 9:52 am
by boxkites
Hi there,
I am new to this but I have picked up a lot of stuff.
Now I have a simple question you might be able to help me with. It is using flat files instead of using a database.

Sending emails out to newsletter subscribers.
I know how to send them out, html as well but I would like to keep the emails from showing.
For argument sake, if I send the newsletter out to 50 subscribers, they can see all the emails in the address column.
I want to keep that private for the subscribers.

If I send say 50 bcc emails from say outlook express, each person does not see other email addresses. They do if you use CC though or if you place them all into the $to section.

How do I do that in php? At the moment I have this :

Code: Select all

 
$nlemail = "me@mysite.com".",";
$to = $nlemail; 
$bcc  = "her@mysite.com".",";
$bcc .= "him@mysite.com".",";
$bcc .= "them@mysite.com".",";
 
mail($to, $subject, $message, $headers);
mail($bcc, $subject, $message, $headers);
 
If i send the mail using $bcc , it sends an mail to all three in this case but each of them can see all three emails when it arrives in their mail client. How can I stop that, so that they can only see their own email? Is this possible using just a flat file? Do I need to place a certain code in there?

Thanks for your help
Robert

Re: bcc emails

Posted: Wed Mar 25, 2009 12:42 pm
by waylon999
try using

Code: Select all

$bcc  = "BCC: her@mysite.com".",";
$bcc .= "him@mysite.com".",";
$bcc .= "them@mysite.com".",";
 

Re: bcc emails

Posted: Wed Mar 25, 2009 2:01 pm
by requinix
...which is the first half of what you need to change.

Code: Select all

$nlemail = "me@mysite.com"; // no comma
$to = $nlemail; 
$headers .= "BCC: her@mysite.com".",";
$headers .= "him@mysite.com".",";
$headers .= "them@mysite.com".",\r\n";
 
mail($to, $subject, $message, $headers);

Re: bcc emails

Posted: Fri Mar 27, 2009 10:59 pm
by boxkites
Hi guys,
Tried both but to no avail. it did send bcc out but it still shows all the bcc emails in the address column of the recipient.

here is what I have right now;

Code: Select all

<?php
 
$nlemail   = "me@mysite.com";
$to = $nlemail;
 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// bcc recipients ?
$headers .= "BCC: her@mysite.com".",";
$headers .= "them@mysite.com".",";
$headers .= "him@mysite.com".",";
 
$subject = 'newsletter draft';
$message = "<h4>My newsletter</h4> <p>This is where the text goes. <br /> Mary did not have a little lamb but a had a great big etc....</p>";
// Send it
mail($to, $subject, $message, $headers);
echo "The mail has been sent. Hopefully to all involved";
?>