php – Hide the list of other message recipients from 1 recipient

Question:

Hello.

How can the recipient of the letter see his e-mail in the "to" field, but without a list of other e-mails?

Operating time:

<?php

$from = 'info@mail.ru';//email отправителя 
$to = '<mail1@mail.ru>, <mail2@mail.ru>'; 
$subject = 'Тема'; 
$body= 'Текст письма'; 
$mailheaders = "Content-type:text/html;charset=utf-8\r\n"; 
$mailheaders .= "From: info@mail.ru\r\n"; 
$mailheaders .= "Reply-To: info@mail.ru\r\n"; 
// почтовые заголовки

$mailheaders .= "Bcc: mail1@mail.ru\r\n";
$mailheaders .= "Bcc: mail2@mail.ru\r\n";
mail($to, stripslashes(trim($subject)), stripcslashes($body), $mailheaders);

?>

Those. so that the user mail1 does not see the mail2 soap and vice versa. Of course you can do $ to = ''; and then the user will be shown "hidden recipients", but he still wants the field to whom to be filled in, and to be filled in correctly.

Answer:

Here's a good way for you, I think:

<?php

$email1 = array("zozozo@mail.ru");
$listmails = array("zozozo1@mail.ru","zozozo@mail.ru","zozozo2@mail.com");
$ready_email_list = array_diff($listmails,$email1); // здесь список емайлов, отличных 
                                                       от $email1
print_r($ready_email_list); // "[0] => zozozo1@mail.ru [2] => zozozo2@mail.com "

?>
Scroll to Top