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.