I have a simple mail function in my page. I use Test Mail Server Tool to check it on local system and it is sending the mail. But when I upload the files to server it is not sending the file
Here is the email code :
if($_POST['name'])
{
    $subject = "Message from website";
    $name = $_POST['name'];
    $email = $_POST['email'];
    $number = $_POST['number'];
    $txt = " Name : " . $name . " \r\n Email : " . $email . " \r\n Contact No. : " . $number;
    $headers = 'From:' . $name . "\r\n";
    $mail=mail('xyz@gmail.com', $subject, $txt, $headers);
    if($mail)
    {
        echo "Thank You!";
    }
    if(!$mail)
    {
        echo "failed";
    }
}
else
    echo "no values entered";
I see 'thank you' message on localhost.But when I upload to server its showing the message 'failed'.
Please help.
Thanks in advance.
 
    