PHP Mail() Headers JunkMail Filtering

Discussion in 'PHP' started by Shoe ButtBack, Mar 24, 2006.

  1. #1
    Ok here is my issue I've been having the past couple of weeks.
    I'm trying to send out a Account confirmation email for my website.
    I use:

    
    
        $headers = "From: MuchGames <webmaster@muchgames.com>\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: ­ 8bit\r\n\r\n"; 
    
        mail($email, "Subject", $body, $headers);
    
    
    PHP:
    When the mail sends to hotmail, it automatically goes into the JunkMail folder.
    I don't have any faul language in my subject or my message.

    How does JunkMail filtering work?
    Is it possible to prevent this from happening?
     
    Shoe ButtBack, Mar 24, 2006 IP
  2. ideas_man

    ideas_man Active Member

    Messages:
    212
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Not entirely sure how Hotmail judges junk mail..... but I'd lose the X-mailer information.

    It's not required and it could be what is causing your problems since it is explicitly stating that the e-mail was generated by a script. When using PHP to send e-mail, I've never included such information and I have never had any problems.

    :)
     
    ideas_man, Mar 24, 2006 IP
  3. stuw

    stuw Peon

    Messages:
    702
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $headers ="MIME-Version: 1.0\r\n";
       $headers .= "From: {$email}\r\n";
       $headers .= "Return-Path: {$email}\n";
       $headers .= "Reply-To: {$email}\n";
       $headers .= "Message-Id: <".time()."@".$_SERVER['SERVER_NAME'].">\n";
       $headers .= "X-Mailer: php-mail-function-0.2\n";
      
       if (mail($to, $subject, $message, $headers,"-f".$email."")) {
    
    }
    Code (markup):
    is what i use - don't know how that works with hotmail tho. be keen to find out if you give it a go
     
    stuw, Mar 24, 2006 IP
  4. sketch

    sketch Well-Known Member

    Messages:
    898
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    148
    #4
    It could be because you're using HTML emails. Many email servers automatically consider HTML emails as spam.

    Many sites specifically point out that hotmail may do this, so you may have to do the same.

    Many other factors come into play with spam... the sending server's IP or domain name, the encoding type (uuencode, utf, base64, etc.), etc.
     
    sketch, Mar 26, 2006 IP
  5. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #5
    There are so many reasons you could be having trouble sending mail. The sender "MuchGames" could be a problem.

    Sending email directly from your machine and not through your ISP could be a problem.

    If your domain's MX record is not absolutely correct, you could have a problem.

    Some servers want your domain to have an authenticated Reverse DNS record.

    Your users could have their Hotmail accounts configured to blacklist everything until they whitelist the sender.

    The X-Mailer could be an issue -- though I am unsure why it would be.

    To test all possibilities, open a hotmail account and accept the default settings for anti-spam filtering. Now send yourself test messages. Try reducing the information in the header. Try sending message as plain text instead of html. Try sending the messages from a gmail account. This will help you isolate the problem to give you a chance at fixing it.
     
    clancey, Mar 27, 2006 IP