无法通过PHP发送电子邮件

时间:2015-06-22 06:07:30

标签: php email

我正在尝试通过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。我也无法调试实际错误。请建议我如何找到根本原因?

0 个答案:

没有答案