Why my mails are not received by Hotmail users?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
guarriman
Forum Commoner
Posts: 44
Joined: Thu Nov 03, 2005 4:11 am

Why my mails are not received by Hotmail users?

Post by guarriman »

Hi.

I created this script to send emails:

Code: Select all

 
$mailFromEmail = "info@mydomain.com";
$mailFromName = "MYDOMAIN";
$mailTo = "jack@gmail.com";
                                                                                                                            
$mailHeaders =
"From: $mailFromName <$mailFromEmail>\n"
. "Content-Type: text/plain; "
. "charset=UTF-8; format=flowed\n"
. "MIME-Version: 1.0\n"
. "Content-Transfer-Encoding: 8bit\n";
                                                                                                                            
$mailSubject = "Hi! " . date('h:i:s A');
$mailMessage = "Hi,\n\nHow are you?\n" . date('l dS \of F Y h:i:s A') . "\n";
                                                                                                                            
mail($mailTo, $mailSubject, $mailMessage, $mailHeaders);
 
In addition, I've set an SPF policy on my DNS server, and I added this line to my 'php.ini' file:

Code: Select all

 
sendmail_path = /usr/sbin/sendmail -t -i -f info@mydomain.com
 
(I've got 'safe_mode=on' on my server)

So Gmail users receive the messages correctly:

Code: Select all

 
Delivered-To: jack@gmail.com
Received: by 10.100.121.18 with SMTP id t18cs105671anc;
        Fri, 4 Apr 2008 06:58:23 -0700 (PDT)
Received: by 10.114.56.1 with SMTP id e1mr1995521waa.52.1207317502773;
        Fri, 04 Apr 2008 06:58:22 -0700 (PDT)
Return-Path: <info@mydomain.com>
Received: from v2v-3.net ([52.147.120.136])
        by mx.google.com with ESMTP id q18si8099195pog.7.2008.04.04.06.58.22;
        Fri, 04 Apr 2008 06:58:22 -0700 (PDT)
Received-SPF: pass (google.com: domain of info@mydomain.com designates 52.147.120.136 as permitted sender) client-ip=52.147.120.136;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of info@mydomain.com designates 52.147.120.136 as permitted sender) smtp.mail=info@mydomain.com
Received: (qmail 21817 invoked by uid 48); 4 Apr 2008 06:58:22 -0700
 
Note the "Return-Path" line and the "Received-SPF" line.

If I change 'jack@gmail.com' with 'jack@hotmail.com', they don't receive my emails. What am I doing wrong?
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Re: Why my mails are not received by Hotmail users?

Post by mchaggis »

I don't think you are doing anything wrong... Have you tried looking in your Junk folder?

I've had this issues in the past with this sort of thing...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Why my mails are not received by Hotmail users?

Post by Chris Corbyn »

Download Swift Mailer and see if your problem goes away using that. There are all kinds of things which you need to think about with mail() including understanding a crap load of RFCs. Although your simple example doesn't look like it would break any RFC.

EDIT | There's also the possibility that you're blacklisted and/or that you don't have a postmaster@mydomain.com address.
Post Reply