1

我检查了 php 手册,但仍然无法让我的脚本工作

如果我删除密件抄送行,邮件将转到 $to1 但使用密件抄送行,它无处可去

这是代码:

// email stuff
$to1 = "address1@mail.com";
$to2 = "address2@mail.com";
$from = "noreply@mail.com"; 
$subject = "Subject"; 
$message = "message";

// a random hash will be necessary to send mixed content
$separator = md5(time());

// carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL;

// main header
$headers  = "To: ".$to1.$eol;
$headers .= "From: ".$from.$eol;
$headers .= "Bcc: ".$to2.$eol;
$headers .= "MIME-Version: 1.0".$eol; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol;

// no more headers after this, we start the body! //

$body = "--".$separator.$eol;
$body .= "Content-Transfer-Encoding: 7bit".$eol;
$body .= "This is a MIME encoded message.".$eol;

// message
$body .= "--".$separator.$eol;
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$body .= "Content-Transfer-Encoding: 8bit".$eol;
$body .= $message.$eol;

// send message
mail($to1, $subject, $body, $headers);

如果有人有想法,非常感谢

4

0 回答 0