Page 1 of 1
mail() Emails filtered as "junk"
Posted: Sun May 15, 2005 1:08 pm
by anthony88guy
So I have a membership area, and I verify each user manually for certain reasons. Each Time I verify a user I would like an email sent to them, saying "Your verified blah blah". With my current code, it sends the email but gets sent to junk mail folder on msn and yahoo. My thunderbird doesn’t accept the email at all.
Code: Select all
$to = "$useremail";
$subject = "Verification";
$message = "message";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "To: ". $to . "\r\n";
$headers .= 'From: Waldo' . "\r\n";
mail($to, $subject, $message, $headers);
Posted: Sun May 15, 2005 1:11 pm
by Pyrite
Perhaps an alternative, try PHPMailer class. It is a bit less prone to errors in headers.
Posted: Sun May 15, 2005 4:40 pm
by Skara
add a Reply-To: header identical to the From: header.
From: and Reply-To: should both be email addys, as well.
Code: Select all
$headers .= 'From: waldo@domain.com' . "\r\n";
$headers .= 'Reply-To: waldo@domain.com' . "\r\n";
Everything I've seen that uses mail() will get put in msn's and yahoo's junk folders, though.

Doesn't make sense...
Posted: Sun May 15, 2005 6:40 pm
by traherom
Using mail() isn't the reason your email's are getting labeled as junk. The receiver has no idea how the email was sent.
My guess is that the use of the work "verification" in the subject is the cause of your trouble. Try it with something different. (Or just for a test, something completely nuetral, like "birthday."

)
Posted: Sun May 15, 2005 7:15 pm
by anthony88guy
Tried both your suggestions no luck. Hows does PhpBB send their mail?
Posted: Mon May 16, 2005 12:57 am
by AGISB
Here is the reason the mail is labled as junk:
mail() uses sendmail to send the mail. Sendmail rewrites the header and adds itself to it. This leads to the problem that the sender cannot be verified by the receiver.
This can only be fixed by adding the last parameter to mail() which leads to a header warning or using another mail function that has its own mail client.
phpmailer works perfectly for this.