Yet another mail()/hotmail spam problem
Posted: Mon Sep 26, 2005 8:50 am
Hello all.
Can anyone see why email sent with the script below insists on ending up in hotmail's "Junk Email" folder?
Things i've tried but haven't worked:
1. I've tried changing the X-Priority to 1
2. I've tried removing $headers .= "X-MSMail-Priority: Normal" . "\r\n"; completely.
3. I've tried setting $fromemail, the From: header and the X-sender to either the domain from which the email is sent or a hotmail domain.
4. I've made sure that the actual message is longer than a couple of lines.
user1@gmail.com receives the email fine but user2@hotmail.com always gets it sent to junk folder.
Any ideas?? Thanks.
Can anyone see why email sent with the script below insists on ending up in hotmail's "Junk Email" folder?
Code: Select all
$recipients = array ("user1@hotmail.com", "user2@gmail.com");
$fromname = "Some name";
$fromemail = "someemail@domain_unrelated_to_domain_from_which_email_is_sent.com";
$subject = "Some Subject";
$message = 'Text';
$message .= '<br /><br />';
$message .= 'Text with a link.';
$message .= '<br /><br />Text';
foreach ($recipients as $to)
{
$headers = "From:$fromname<$fromemail>\r\n";
$headers .= "To:<$to>\r\n";
$headers .= "X-Sender:$fromemail\r\n";
$headers .= "Reply-To:$fromname<$fromemail>\r\n";
$headers .= "Return-Path:<$fromemail>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "X-Priority: 2\r\n";
$headers .= "X-MSMail-Priority: Normal" . "\r\n";
$success = mail($to, $subject, $message, $headers, '-fsomeemail@domain_unrelated_to_domain_from_which_email_is_sent.com');
if ($success)
{
echo "Email successfully sent to $to<br />";
}
else
{
echo "<strong>Email was not successfully sent to $to<br />";
}
}1. I've tried changing the X-Priority to 1
2. I've tried removing $headers .= "X-MSMail-Priority: Normal" . "\r\n"; completely.
3. I've tried setting $fromemail, the From: header and the X-sender to either the domain from which the email is sent or a hotmail domain.
4. I've made sure that the actual message is longer than a couple of lines.
user1@gmail.com receives the email fine but user2@hotmail.com always gets it sent to junk folder.
Any ideas?? Thanks.