Page 1 of 1

Yet another mail()/hotmail spam problem

Posted: Mon Sep 26, 2005 8:50 am
by mat106
Hello all.

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 />";
							}
						}
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.

Posted: Mon Sep 26, 2005 11:09 am
by Charles256
probably because of the domain name the e-mail is coming from. your domain might not be recognized as one of their "trusteD" senders and therefore are junk mail:) it's not exactly a script problem:-D

Posted: Mon Sep 26, 2005 1:04 pm
by phoenix121
yeah, if your emali is filtered to junk, its the content of the email, not your script.

theres an example of that script, but i think its not as good as yours - http://felix.dehnz.net/e/ - click the 'source code' link at the bottom.

Posted: Mon Sep 26, 2005 1:20 pm
by $var
most host have a filter to accept only recognized/friendly senders.
if your host is smaller, or, perhaps they just haven't gotten around to it,
ask them to look into getting their e-mail verified with the major servers.

Posted: Mon Sep 26, 2005 2:10 pm
by RobertPaul

Code: Select all

$fromemail = "someemail@domain_unrelated_to_domain_from_which_email_is_sent.com";
Eh, that might have something to do with it. Don't quote me on it, though.