PDA

View Full Version : PHP Email script that passes Hotmail Junk


RandomLove
Fri 27th May '05, 3:45am
Hi,
I'm trying to build a small script to email current users with special offers. I did build a small script but the emails always go to Hotmail Junk folder.

Here is the code I used...Anyway to change that so Hotmail don't treat my messages as Junk?


//buileremail
$strURL = $sSiteName . "user.php?u=" . base64_encode($sEmail);
//echo $strURL;
$strSenderEmail = 'name@domain.com';

$http_host = 'domain.com';
$delimiter = "\n";

$headers = 'From: name <' . $strSenderEmail . '>' . $delimiter;
$headers .= 'Reply-To: whatever@whereever.com' . $delimiter;
$headers .= 'Return-Path: me@domain.com' . $delimiter;
$headers .= 'MIME-Version: 1.0' . $delimiter;

$msgid = '<' . gmdate('YmdHs') . '.' . substr(md5($message . microtime()), 0, 6) . vbrand(100000, 999999) . '@' . $http_host . '>';
$headers .= 'Message-ID: ' . $msgid . $delimiter;

$headers .= 'X-Priority: 3' . $delimiter;
$headers .= 'X-Mailer: Private Mailer' . $delimiter;
$headers .= 'Content-Type: text/html; charset=\"iso-8859-1\"' . $delimiter;
$headers .= "Content-Transfer-Encoding: 8bit" . $delimiter;

$message = '<table border="0" width="364" style="font-family: Verdana; font-size: 10pt" cellspacing="1" cellpadding="4" align="center">';
$message .= '<tr>';
$message .= '<td bgcolor="#9E3EFF" colspan="2" style="color: #FFFFFF; font-weight: bold">Welcome to our Summer Surprises</td>';
$message .= '</tr>';
$message .= '<tr>';
$message .= '<td bgcolor="#E9D2FF" colspan="2" align="center"><a href="' . $strURL . ' ">';
$message .= 'Click here to get it</a></td>';
$message .= '</tr>';
$message .= '</table>';

mail($sEmail, 'Check the great news', $message, $headers);

//end buildeemail

Marco van Herwaarden
Fri 27th May '05, 5:23am
Start by making sure that the sender address is the same as the return address.

Also avoid using to many "Click here" and things like that. Have a look at Spam mails, and see what text is used frequently, then try to avoid that.

RandomLove
Fri 27th May '05, 12:02pm
Hi MarcoH64,

I tried so many tricks. I even sent an email from my ISPs account using Outlook to my Hotmail account and then copied everything in the header from that email to my PHP Emailer but no luck. I'm sure there is a trick somewhere.

I also used SquirrelMail to send email to my Hotmail account which also went OK and didn't go to Junk email. SquirrelMail uses PHP but Hotmail didn't recognizes it as Junk...:confused:...I copied SquirrelMail headers to my PHP Emailer, however Hotmail caught it as Junk...I'm really stuck...:(

Please help
Thanks

R.L.

RandomLove
Fri 27th May '05, 12:38pm
Hi again,
I tried setting the return-path using "-f $from" but I got the following line inserted into header X-Authentication-Warning: domain.com: nobody set sender to mail@domain.com using -f
Of course the email went to Junk.

I changed "mail" & "domain" to hide the actual one.

Regards,
R.L.

Zachery
Fri 27th May '05, 12:52pm
use a real SMTP server, instead of using php's mail function :)

RandomLove
Sat 28th May '05, 3:21am
Hi Zachery,
I'll try that one..thanks

R.L. :)

KeithMcL
Sat 28th May '05, 11:56am
How do you know it's the script itself and not the content of the email?