I am trying to write some php code to send email for a form in html but it's not working as expected. The function returns a success messsage but i didn't get any mails in my inbox. I have referred other similar questions like : PHP mail function doesn't complete sending of e-mail but doesn't get any idea.
My PHP code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$Mobile = $_POST['Mobile'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $Mobile \n Message: $message";
$subject = "Query";
$header = "From: Team <team.noreply@gmail.com>\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
if(mail($email, $subject, $formcontent, $header))
{
echo "Thank You!" . " -" . "<a href='index.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
}
else
{
echo '<p>Something went wrong. Please try again!</p>';
}
?>
I am hosting my website on 000webhosting.com using free account.
I came to know that free hosting doesn't provides all the functionalities and i'm not sure whether there's something wrong with my code or it's related to webhosting servers.
Kindly help me out and if there's issue with server then pls let me know if there's some server where i can test my code.
Thanks