我正在尝试通过php脚本发送邮件,而且相对较新的php。我在下面写了代码:
<?php
$to = "xyz@somedomain.com";
$subject = "This is subject";
$message = "This is simple text message.";
$header = "From:abc@somedomain.com \r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true )
{
echo "Message sent successfully...";
}
else
{
echo "Message could not be sent...";
}
?>
但是我无法发送电子邮件而retval返回false。我也无法调试实际错误。请建议我如何找到根本原因?