php邮件功能返回false,但仍在发送邮件。
我尝试使用正确的密件抄送发送邮件,它发送邮件并返回true。 但是,如果发送错误的密件抄送邮件,但返回值(mail();)为假。
<?php
$to = "xyz@test.com";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$bcc = "xyz"; //tried giving wrong bcc
// More headers
$headers .= 'From: XYZ<xyz@test.com>' . "\r\n";
$headers .= 'Bcc: '.$bcc . "\r\n";
if(mail($to,"subject","mail_body",$headers))
echo "Sent";
else
{
echo "failed";
print_r(error_get_last());
}