mail function + spam

Discussion in 'PHP' started by Grit., Jan 5, 2010.

  1. #1
    I've started to use the mail function in php quite heavily in my latest scripts, however all of my emails sent from my site end up in the spam box. Is there any way i can attempt to prevent my mail being marked as spam?

    In case you're wondering, it's being used in the registration part of the script in order to authorise a registration attempt
     
    Grit., Jan 5, 2010 IP
  2. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Make sure the sending box has it's rDNS set correctly. That's usually the main issue.

    Without knowing the url of the site, the IP address of where the email is coming from or at least seeing the headers of the mail message in question, it;s hard to tell what's occurring. (That's a hint by the way.)
     
    theapparatus, Jan 5, 2010 IP
  3. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #3
    Make sure you're not blacklisted.

    Also, try to make your email more personal to the user. It sometimes works with some recipients.
     
    peter_anderson, Jan 5, 2010 IP
  4. cyberwave

    cyberwave Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you can use any spam checker tool to see if the message you are sending has content that can be treated as spam.
     
    cyberwave, Jan 5, 2010 IP
  5. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #5
    The url of the site is currently varying as i keep changing where i'm testing it domain wise, but it's based on the same server. The IP of the website is 213.229.86.50 currently, and the headers are:

    $emailheaders = 'From: '.$adminemail.' ' . "\r\n" .
    'Reply-To: '.$adminemail.' ' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    I'm pretty new to the use of the mail function, so all help is greatly appreciated.
     
    Grit., Jan 6, 2010 IP
  6. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Has rDNS (Hydra.3v0.net) so that's fine. If you have access, you need to lowercase the 'H' as it;s not correct. I wouldn't call that a reason to block though.

    Those aren;t headers though. That's the code that makes them. If that's what's coming out in the emails though, that's a problem. Do you have a sample email that you can copy and paste from?

    Reference: http://uic.edu/depts/accc/newsletter/adn29/legitmail.html

    Some of that is added (or should be added) by the mailer.

    Take a look at how wpmu does theirs:

    http://trac.mu.wordpress.org/browser/trunk/wp-includes/wpmu-functions.php#L1595

    Looks like mime and content type is missing at the very least.

    Hope this helps,
    -drmike
     
    theapparatus, Jan 6, 2010 IP
  7. Mail Propeller

    Mail Propeller Peon

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    A lot of good solutions have been posted already.

    Check all the solutions above first...
    Then if you are still landing in the spam folder and don't know why, try using a few accounts and marking it as "not spam".

    Sometimes the spam filter default is to assume you are spam if you have no reputation.
     
    Mail Propeller, Jan 7, 2010 IP