невозможно отправить несколько сообщений скрытой копии

Я пытаюсь отправлять скрытую почту. Моя почтовая функция работает для одной почты, но когда я пытаюсь получить скрытую почту, у меня ничего не происходит. Помогите мне для возможного решения.

    <?php
if(isset($_POST['submit'])){
//$to = "example@com"; // this is your Email address
$to = "example@com";
$from = $_POST['email']; // this is the sender's Email address
$first_name = $_POST['name'];
$last_number = $_POST['number'];
$last_query = $_POST['query'];
$last_state = $_POST['state'];

$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $first_name . " " . $last_name ." ".$last_number." ". $last_query." ".$last_state." ". " wrote the following:" . "\n\n" . $_POST['message'];
$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo $mag="Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>

0

Решение

Вам необходимо отправить Bcc только в заголовках, как показано ниже:

headers .= "Bcc: addess1,addess2,etc \r\n";

0

Другие решения

Вы должны попробовать этот формат. также нет скрытой копии в вашем коде

$headers  = 'MIME-Version: 1.0' . "\\r\ ";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\\r\ ";
$headers .= 'To: test <test@example.com>, test1 <test1@example.com>' . "\\r\ ";
$headers .= 'From: test3 <test3@example.com>' . "\\r\ ";
$headers .= 'Cc: [email]test4@example.com[/email]' . "\\r\ ";
$headers .= 'Bcc: [email]test5@example.com,test6@myserver.com,test7@gmail.com,test8@email.com[/email]' . "\\r\ ";
mail($to, $subject, $message, $headers);
0

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector