我正在尝试使用mail()函数发送邮件。但它不发送邮件。返回值false。
if ( filter_var($_POST['msgEmail'] , FILTER_VALIDATE_EMAIL))
{
$to="pnoushid@gmail.com";
$from = $_POST['msgEmail'];
$name = $_POST['msgName'];
$subject="comments from ".$name;
$message=$_POST['txtcomments'];
$message=wordwrap($message,70,"<br>");
$message=str_replace("\n.","\n..",$message);
$headers='From: '.$from;
$mail=mail($to, $subject, $message);
if ($mail==TRUE)
$message="<script type='text/javascript'
alert('comment has been sent');
</script>";
else
$message= "<script type='text/javascript'>
alert('Comments are not send at this time!.thanks');
</script>";
}
答案 0 :(得分:0)
也许安装Sendmail它会起作用。