0

I am working on a contact us form, which sends an email to an email ID.

Following is the php script :

<?php
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $visitor_email = $_POST['email'];

        $email_from = "xxx@yyy.co.in";
        $email_subject = "New form submission";
        $email_body = "You have received a new message from the user $name";

        $to = "xxx@yyy.co.in";
        $headers = "From: $email_from \r\n";
        $headers .= "Reply-To: $visitor_email \r\n";

        $flag = mail($to,$email_subject,$email_body,$headers);
        echo $flag;
    ?>

When I click Submit button I send a POST call to the page containing above script.

I receive form data correctly on that php page, but the email is not sent to the concerned email ID. The php mail() function returns false.

What may be the problem? Do I need to configure anything in the php.ini file?

I am working on Linux Mint and using LAMP.

Sohan Shirodkar
  • 510
  • 3
  • 24
  • Possible duplicate of http://stackoverflow.com/questions/8803994/php-mail-not-working-for-some-reason – infinigrove Jan 22 '17 at 12:36
  • 1
    Possible duplicate of [PHP mail not working for some reason](http://stackoverflow.com/questions/8803994/php-mail-not-working-for-some-reason) – Gábor Bakos Jan 22 '17 at 13:39

0 Answers0