php mail function problem

good day.,
I have problem with php mail function…i get success message by operating this code on localhost… but I cannot recieve mail in my gmail ID as specified in the code … neither I get the mail in MS outlook… I have also made setting of outlook … what should I do … kindly help me … below is the code that I uses
[php]<?php
$to = "[email protected]";
$subject = “Test mail”;
$message = “Hello! This is a simple email message.”;
$from = "[email protected]";
$headers = “From:” . $from;
if(mail($to,$subject,$message,$headers)){
echo “success!”;
}else {echo “error”;}

?> [/php]

GMail will check to see if the hostname (gmail.com) of the from sender matches that of the IP and hostname from which the request that your e-mail came from. In this case, it won’t as you’re using localhost to send the mail.

In situations when I need to test e-mail from a localhost that might not match up properly with sender hostnames etc, I use mailinator - a free service designed for temporary e-mails. What I do is to create a mailinator e-mail then send the mail to that. I can then check my mailinator e-mail.

Mailinator

Sponsor our Newsletter | Privacy Policy | Terms of Service