0

I am attempting to send mail using mail() function. But it does not send the mail. Returns value 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>";
}

1 Answers1

0

Maybe installing Sendmail it will work.

FranMercaes
  • 141
  • 1
  • 1
  • 12