I'm trying to send a newsletter with PHPMailer meanwhile protecting my customers privacy.
At first I set the receiver configuration with mail->addAddress('customerEmail']);
but I found out that sending it this way, every receiver could see other customer's subscribers E-mail addresses.
I changed the addAddress
to mail->addBCC('customerEmail']);
so that it doesn't show every E-Mail address (in fact now it even doesn't show the recipient E-mail address of the customer it's being send to), but this way if anyone wanted to reply to the E-mail, their response would also be sent to the rest of the subscribers...
What is for you the best option to face this problem?
As I was advised, the best way to manage a newsletter is to send the email individually to every customer although it means a slight increase on the sending time. This way you can offer automated unsubscription links and other features that otherwise you couldn't.
In order to achieve that, I just made a simple loop getting the addresses from my db:
$sql = "SELECT `email` FROM `emails`";
$statement = $db->prepare($sql);
$statement->execute();
while ($fila = $statement->fetch()) {
if(!empty($fila['email'])){
$mail->addAddress($fila['email']);
$success = $mail->Send();
$mail->clearAllRecipients(); //Don't forget this!
}
}
The method clearAllRecipients();
is very important as it's the one who will clear the last lap recipient so that the 'to' section of the email doesn't show all your newsletter recipients.