Forum Moderators: coopster

Message Too Old, No Replies

mail function won't send email to Yahoo,Gmail

mail,yahoo,gmail

         

NeilsPHP

3:39 pm on Feb 28, 2009 (gmt 0)

10+ Year Member



i have a small mail script that will generate an email verification to subscriber.It works fine for almost all emails but Yahoo and gmail can not receive it.
I tried using horde but no good.It does not even give any error ..and is listed under sent folder.
plz help

NeilsPHP

3:44 pm on Feb 28, 2009 (gmt 0)

10+ Year Member



here is the php code ..

<?

$email = "any_address@yahoo.com";

$to=$email;
$subject="welcome";
$header="from:me@mysite.com";
$message="Dear User,Thank You for signing up. ";

if(mail($to,$subject,$message,$header))
{
echo "mail sent successfully";
}
else
{
echo "mail not sent..error";
}

?>

Good thing is it sends to hotmail without any problem.

rainborick

3:52 pm on Feb 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yahoo! and GMail aggressively filter suspicious EMail. You might have better luck if you use:

$header="From: me@mysite.com";

Note the capitalization of "From" and the space after the colon, which is the conventional formatting. Some services may not recognize your formatting, assume the return address is missing, and classify your message as SPAM.

NeilsPHP

7:01 pm on Mar 1, 2009 (gmt 0)

10+ Year Member



Thank you rainborick,
I can't believe this was the problem.I can't thank you enough.