I run this script to send to each user an email. Mails are sent ok(one to each user), but in the email sent all the others adresses are shown in the headers.
$all_users = array(); // intialzie array
while ($usuario = mysqli_fetch_array($resultado, MYSQLI_ASSOC)) {
$usermail = $usuario['email'];
$hash = $usuario['hash'];
mysqli_query($dbc, "UPDATE newsletter SET enviado = '1' WHERE email='$usermail' ");
$all_users[] = $usermail; // push all emails first
}
// then send
try {
$email->setTos($all_users)
->setFrom("[email protected]")
->setFromName("test")
->setReplyTo("[email protected]")
->setSubject("Test")
->setHtml('test');
$result = $sendgrid->send($email);
echo "enviado";
} catch(\SendGrid\Exception $e) {
echo $e->getCode() . "\n";
foreach($e->getErrors() as $er) {
echo $er;
}
}
?>
How can i hide other emails while sending them individually using sendgrid (bcc - blind carbon copy)?
To:
. send it to yourself, or a blackhole address. – Marc B