Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    377
    Thanks
    8
    Thanked 1 Time in 1 Post

    Mail problem with Hotmail

    Hi,

    When I investigated a site I've built, I've found out that nearly half of the users did not activate their account. I've digged deeper and found out almost %90 of these non-activated users had applied for an account through their hotmail account.

    It is obvious that hotmail users can't receive the activation mails I've sent through PHP mail function and therefore can't activate their accounts.

    But, I also have activated users -not that many- with hotmail accounts. So, sometimes the mail goes through.

    I've found on the net that many people had this problem.

    This is a big problem as my client is asking me why this happens. Before I put the %100 blame to hotmail, I'd like to know if there is anything I can do to improve or guarantee to be accepted by the glorious MS Hotmail.

    Here is my code, although I don't think anything is wrong. Yahoo or Gmail have no difficulties receiving this email.

    PHP Code:
            $headers  = "";
            $headers .= "MIME-Version: 1.0\r\n";
            $headers .= "Return-Path: <system@myclientsdomain.com>\r\n";
            $headers .= "Content-Type: text/html; charset=utf-8\r\n";
            $headers .= "Content-Transfer-Encoding: 7bit\r\n";
            $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
            $headers .= "X-Priority: 3\r\n";
            $headers .= "X-MSMail-Priority: Normal\r\n";
            $headers .= "From: My Client <system@myclientsdomain.com>\r\n";
            $headers .= "To: $name $surname <$email>\r\n\r\n";
            $subject = "Your Activation";
            $message = "";
            $message .= "<html><head><title></title>";
            $message .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
            $message .= "</head><body>";
            $message .= "<p>Dear $name $surname,</p>";
            $message .= "<p>Thanks for signing up to our website!<br>";
            $message .= "One last step is needed to activate your account.<br>";
            $message .= "<p>Please click on the link below to activate:</p>";
            $message .= "<p><a href=\"http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token\">http://www.myclientsdomain.com/activate.php?op=activate&confirm=$token</a></p>";
            $message .= "<p>Thanks!<br>";
            $message .= "My Client</p>";    
            $message .= "<p>This is an automated message, please do not reply.</p>";
            $message .= "</body></html>";
     
            if (@mail($email, $subject, $message, $headers)) {
                include ("header.php");
                ?>
                <table width="100%" cellspacing="8" cellpadding="8" border="0">
                <tr>
                <td valign="top">
                <h2 align="center">Thanks...</h2> 
                <p>Dear <?php echo "$name $surname"?>,<br><br>An activation email has been sent to the email address you provided.<br>
                Please click on the link in this email to activate your account.</p>
                <p><b>ATTENTION:</b> Some free email providers (Hotmail, Yahoo, Gmail...) forward email messages to their "Bulk", "Junk", "Spam" folders.<br>
                If you think you did not receive our activation email in your inbox, please check the folders mentioned above.</p>
                <p>Thanks,<br>
                My Client</p>
                </td>
                </tr>
                </table>
                <?php
                
    include ("footer.php");
            }

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,036
    Thanks
    2
    Thanked 316 Times in 308 Posts
    About the only things I see from your code is I would not put the < > around the return-path email address (only use the < > when there is an alias <name> portion before the email address.) And, put a Reply-to: field.

    If your email was ending up in the junk/spam folder at msn/hotmail, the most likely cause is the lack of an SPF record. If it is not being received at all, it is likely a problem with the configuration of your server's DNS records or the configuration of the mail server and/or your mail server has been banned by msn/hotmail or appears on spam databases that hotmail uses.

    Here is a recent thread concerning getting email accepted - Sending Email with PHP
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    377
    Thanks
    8
    Thanked 1 Time in 1 Post
    Hello, thanks for your reply. I can say the following:

    nd, put a Reply-to: field.
    I already have a Return-Path. Do I need a Reply-to field that bad?


    (only use the < > when there is an alias <name> portion before the email address.)
    Hmm, I have the name portion, which is, My Client, in this case.

    $headers .= "From: My Client <system@myclientsdomain.com>\r\n";

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,036
    Thanks
    2
    Thanked 316 Times in 308 Posts
    I wrote -
    I would not put the < > around the return-path email address
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    Regular Coder
    Join Date
    Jan 2006
    Posts
    377
    Thanks
    8
    Thanked 1 Time in 1 Post
    Got it

    And I found out that the problem probably relates to the SPF record. Hotmail checks for SPF records since 2004. I instructed my hosting provider to add a SPF record for my domain and hope the problem gets solved.

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Posts
    377
    Thanks
    8
    Thanked 1 Time in 1 Post
    Nearly all the emails sent to hotmail accounts are bouncing. This is the system message I am getting at my default email address:

    This message was created automatically by mail delivery software.

    A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es) failed:

    name_surname@hotmail.com
    SMTP error from remote mail server after RCPT TO:<name_surname@hotmail.com>:
    host mx1.hotmail.com [65.54.245.8]: 550 Requested action not taken:
    mailbox unavailable

    ------ This is a copy of the message, including all the headers. ------
    I don't think hundreds of users enter their email address wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •