Send Private Emails To Multiple Email Adresses - PHP

Hello There,

I am trying to send newsletters to my subscribers. But when i am sending mail successfully sended but whoever receives the mail see the all emails where this mail is sended. I want to hide that all emails. I want that show - “to (Receiver adress)”

My coding :–

$emails = ",";

$email_to = "$emails";
$headers   = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: OnlineDealsIndia <>";
$headers[] = "Bcc: $emails";
$headers[] = "Reply-To: Support | OnlineDealsIndia <>";
$headers[] = "X-Mailer: PHP/".phpversion();

$subject = "Newsletter | OnlineDealsIndia";
$message = 'Hello There,

This is and Test email.

Thank you
OnlineDealsIndia Team';
mail($email_to, $subject, $message, implode("\r\n", $headers));

So pls help me.

You can do this a couple of ways.

  1. Loop through your $emails list, and send the email separately to each address. This is what most mailing systems are going to do.

  2. You could send it to only yourself, and BCC everyone else. But that doesn’t sound like what you were looking for.

Right now, you seem to be sending this message TO all of your recipients and also BCC all of your recipients. You don’t want both.

Make any sense?

I’d implode() the $emails variable into an array of email addresses, then use a foreach() loop to create an individual message for each recipient, send the message, loop around to the next address until done.

The quick and easy way, as noted by @jeffreylees above, is to just change this line

$email_to = "$emails";


$email_to = ""

That way the mail will be sent to your address, with a BCC copy to each address in $emails.

That doesn’t really achieve anything much anyway.

The emails will all be sent separately anyway so doing that only results in one more email being sent (to yourself) than if you send them all separately in the first place. The difference if you send them separately is one less is sent and also the recipient appears in the to address.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.