好的,这就是我所拥有的,我需要将它发送到电子邮件的电子邮件地址盲人CC。想法?我尝试过使用$ BCC选项,它似乎对我不起作用。而且我宁愿拥有它,每个人都不知道它会去哪里。
<?PHP
$to = "addressone@unknown.com; addresstwo@unknown.com";
$subject = "Subject";
$headers = "who it's from";
$forward = 1;
$location = "Thank you Address.html";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
好的,这就是我尝试过的,它似乎仍然不起作用,我知道我在某处遗漏了某些东西。我知道,当我终于可以把它作为一个密送发送时,我希望它发送它与另一个以及它来自哪个主题。
$to = "email@email.com";
$subject = "subject1";
$headers = 'Bcc: email2@email.com' . "\r\n";
$headers = 'From: Complaint' . "\r\n";
$forward = 1;
$location = "thank-you.html";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
答案 0 :(得分:1)
您需要将BCC指定为mail命令的附加标题的一部分 来自the documentation example:
$to = 'user1@example.com, user2@example.com';
// subject
$subject = 'MESSAGE SUBJECT';
// message
$message = 'MESSAGE BODY HERE';
// Additional headers
$headers = 'Bcc: bcc_user1@example.com, bcc_user2@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
答案 1 :(得分:0)
问题是你覆盖了$ headers的值,第二次使用。=。 试试吧:
$to = "email@email.com";
$subject = "subject1";
$headers = 'Bcc: email2@email.com' . "\r\n";
$headers .= 'From: Complaint' . "\r\n";
$forward = 1;
$location = "thank-you.html";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
享受您的代码!