View Full Version : PHP Mail Function E-mails Go To Spam Folder...

02-11-2006, 05:58 PM

On my website, I have many automated e-mails containing userid's, passwords and order confirmations. The problem is many of these e-mails do not reach the sender or go into the e-mail's spam folder for yahoo and msn accounts. I have tested this over and over and the e-mails do go. Is there any solution to this? Below is the source code for the e-mails.
Thank you for your help!

//Mail Headers
$headers = "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "Return-Path: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

//E-mail Info -Fictional Stuff
$email_addr="bill@hotmail.com"; //Usually grabbed from database
$subject="E-mail Subject Line";
$message="E-mail Content Goes Right Here...";

//Mail Function
mail($email_addr, $subject, $message, $headers,"-f $from");

//I think that's all.

02-12-2006, 12:54 AM
Looks like your syntax is incorrect. Here's an example from the manual (http://us2.php.net/manual/en/function.mail.php):

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.

mail('nobody@example.com', 'the subject', 'the message', null,
BTW, you'd do well to read that whole page I gave the link to. There's a lot of good information about sending mail in a PHP program.

02-12-2006, 02:05 AM
Thanks for the reply vinyl.

So is this the part you see is worng? '-fwebmaster@example.com'

Also, what does null represent in the mail function? I couldn't find any refrence to it in the manual except it being used in a demo with no refrence to it but I might of missed it.
Thank you.

02-12-2006, 02:27 AM
Nevermind about the null question. I figured that one out. I did change a couple of things but it didn't change a thing. E-mails still won't go through hotmail. Any other suggestions?

02-12-2006, 03:27 AM
The only thing I can think of is to read that whole page I referenced. Lots of people have problems with the mail ending up in the spam folder. Unfortunately, there isn't a "one size fits all" solution.

02-13-2006, 04:54 PM
Services like hotmail and yahoo detect whether an email was generated using a machine (server-side form) or software (e.g. outlook express).

Alot of generated emails have problems with hotmail and yahoo for this reason.

Also check your subject line to make sure it has no spam keywords.

02-13-2006, 07:56 PM
Thanks for the help and suggestions. The best I have been able to is complete acceptence from yahoo mail and with hotmail it goes in the spam folder. I spent hours tweaking my e-mail headers...

06-02-2009, 07:55 AM
Hi friends ,

I am using the plesk vps server,
When i used to sending the mails from the php SMTP code(phpmailer class),
then that mail send to spam folder,

This is happen to when i am usied to send the mail to yahoo mail id.

How to solve this issue.

please help me.

Anil Kumar