[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 746
  • Last Modified:

php email goes to spam

Hi, I have been trying for quite some time now to get our emails to not end up in the spam folder of Yahoo, AOL, and hotmail.  I have had no problems with Google thus far.

I have added domain keys and dkim to the emails and they both pass with Yahoo.  I have added SPF to the domain and rdns.  I have verified that the content of the email works when sent through gmail.  Our IP is not on any blacklist.  I have compared email headers and not found anything majorly different between our emails and emails that make it to the inbox, save for this line in Yahoo: X-YahooFilteredBulk:

What am I missing?

I have attached the email header for your scrutiny.  Thanks in advance for your time

X-Apparently-To:                 someone@yahoo.com via; Thu, 01 Apr 2010 14:43:13 -0700
Return-Path:             <postmaster@some-domain.com>
X-YMailISG:             somereallynicelongstring--
X-Originating-IP:             []
Authentication-Results:             mta165.mail.ac4.yahoo.com from=some-domain.com; domainkeys=pass (ok); from=some-domain.com; dkim=pass (ok)
Received:             from (EHLO some-domain.com) ( by mta165.mail.ac4.yahoo.com with SMTP; Thu, 01 Apr 2010 14:43:13 -0700
Received:             from some-domain.com (localhost []) by some-domain.com (8.13.8/8.13.8) with ESMTP id o31LhBT3029362 for <someone@yahoo.com>; Thu, 1 Apr 2010 15:43:11 -0600
DKIM-Signature:             v=1; a=rsa-sha256; c=simple/simple; d=some-domain.com; s=dk; t=1270158191; bh=somestring=; h=Date:Message-Id:To:Subject:MIME-Version:Content-type:From: Reply-To; b=somenicelongstring=
DomainKey-Signature:             a=rsa-sha1; s=dk; d=some-domain.com; c=simple; q=dns; b=somenicelongstring=
Received:             (from root@localhost) by some-domain.com (8.13.8/8.13.8/Submit) id o31LhACr029361; Thu, 1 Apr 2010 15:43:10 -0600
Date:             Thu, 1 Apr 2010 15:43:10 -0600
Message-Id:             <201004012143.o31LhACr029361@some-domain.com>
To:             some one <someone@yahoo.com>
Subject:             Welcome to yearbook
MIME-Version:             1.0
Content-type:             text/plain; charset=iso-8859-1
From:             This sender is DomainKeys verified
yearbook support team <postmaster@some-domain.com>  
Add sender to Contacts
Reply-To:             postmaster@some-domain.com
X-Mailer:             PHP's mail() Function
Content-Length:             460
  • 5
  • 2
  • 2
2 Solutions
the idea of sending a mail as "root@localhost" is bound to create problems.

Received:             from some-domain.com (localhost []) by some-domain.com
Received:             (from root@localhost) by some-domain.com

Are you setting your domain name with something that yahoo is resolving to "localhost" /

johndupaixAuthor Commented:
rdns lookup resolves correctly, hostname on computer is same as rdns return.  

I have noticed root@localhost in header but am not quite sure how to get rid of it.
 My domain is yearbook-app.com.

i think you are running the script as root.  can you run it as a simple user and set the sender properly (also pays to check your sendmail config file to enable MASQUERADE options properly).
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

johndupaixAuthor Commented:
Thanks again for your input.

I ran as postmaster.
by "set the sender properly" I understand that to mean in the header to the php call which I have as:
'From: yearbook support team <postmaster@yearbook-app.com>'.

My masquerade options are as follows


The header line that used to have root@localhost now looks like this:
Received:                 (from postmaster@localhost) by yearbook-app.com (8.13.8/8.13.8/Submit) id o35FoVho012991; Mon, 5 Apr 2010 09:50:31 -0600

Have I set my masquerade options wrong?

You need to tweak your /etc/hosts file. Make it look like this:   yearbook-app.com  yeabook-app localhost.localdomain localhost

(make sure the real domain you want to use is first in the list of domains for the localhost address. You might have to restart sendmail when you make this change.
johndupaixAuthor Commented:
Awsome!!!!   That did it!!

I ran this after changing the hosts file
/etc/rc.d/init.d/network restart

Glad that worked for you...
johndupaixAuthor Commented:
Interestingly, the header line still looks like this:

Received:                 (from postmaster@localhost) by yearbook-app.com (8.13.8/8.13.8/Submit) id o36FspMI017919; Tue, 6 Apr 2010 09:54:51 -0600

Out of curiosity, I changed the hosts file back and my emails are still making it to the inbox.

Also of interest is that this morning I received an email from Yahoo saying our company was rejected for their bulk mail program.  (we are not a spam company, we just have lots of opted in users).

Here is everything I did to get email going to the inbox:

changed hosts file as described above.
added masquerading as described above.
changed sender as described above.
requested acceptance into yahoo bulk email program
added reverse dns entry for email server
added domain keys to email
added dkim to email
made sure email server was not an open relay

Our emails are making it to the inbox.  

Thanks to all for your assistance.
johndupaixAuthor Commented:

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now