我正在尝试向不同的地址和不同的主题发送 2 封电子邮件。
$to = 'contact@example.com';
$from = $_POST['email'];
$subject = 'Contact - '.$_POST['subject'];
$message = utf8_decode($_POST['msg'])."\r\n";
$message .= "\r\n-------";
$message .= "\r\nPhone: ".$_POST['tel']." - E-mail: ".$_POST['email'];
$headers = 'From:'.$_POST['email']. "\r\n" .
'Reply-To:'.$_POST['email']. "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers2 = "From: Company <noreply@example.com>\n";
$headers2 .= "MIME-Version: 1.0\r\n";
$headers2 .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message2 = "<html><body>
Thanks for your contact!</body></html>
";
mail($to, $subject, $message, $headers);
mail($from, "Thanks for your contact!", $message2, $headers2);
但只有最后一个在工作。怎么了?谢谢!