Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a CentOS 6.4 server. When I send an email using the mail command from command line, it's always marked as spam by Gmail. So, every system emails go to spam and so do every emails sent with a PHP script.

My rDNS should be fine.

$ host domain name pointer

$ host has address mail is handled by 10

SPF is marked as pass as you can see in these headers (from an email which gmail has marked as spam):

Delivered-To: *******
Received: by with SMTP id r5csp188653pda;
        Mon, 26 Aug 2013 18:50:19 -0700 (PDT)
X-Received: by with SMTP id n1mr30567514eex.15.1377568217754;
        Mon, 26 Aug 2013 18:50:17 -0700 (PDT)
Return-Path: <>
Received: from ([2a02:29e0:2:4::b5b6:f0bd])
        by with ESMTPS id q8si12101539eem.60.1969.
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Mon, 26 Aug 2013 18:50:17 -0700 (PDT)
Received-SPF: pass ( domain of designates 2a02:29e0:2:4::b5b6:f0bd as permitted sender) client-ip=2a02:29e0:2:4::b5b6:f0bd;
       spf=pass ( domain of designates 2a02:29e0:2:4::b5b6:f0bd as permitted sender)
Received: from root by with local (Exim 4.76)
    (envelope-from <>)
    id 1VE8Q9-0005lK-Q8
    for *******; Tue, 27 Aug 2013 03:50:13 +0200
Date: Tue, 27 Aug 2013 03:50:13 +0200
To: *******
Subject: 1 updates available for
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <>
From: root <>

RoundCube webmail 0.9.2 to 0.9.3 update is available.

Moreover, as you can see from these headers, my From field matches the address in the Received field.

What else should I try?

share|improve this question
Are you the owner/operator of this server, or you just a client on shared hosting? – Sammitch Aug 29 '13 at 18:38
@Sammitch, I'm the owner of the server. – Zagorax Aug 29 '13 at 22:35
Even though you fixed it, I'm curious what your HELO is. It should be the same as the rDNS name. In Postfix, that would be the myorigin config parameter. In Ubuntu based systems (don't know about CentOS), it gets it from /etc/mailname. Oh, and +1 for mentioning the real domain and IP :) – Halfgaar Mar 3 '15 at 13:05
up vote 1 down vote accepted

I've found a solution.

As you can see from the headers, my server was recognized by its ipv6 address, and I haven't set reverse DNS for ipv6.

Basically, if you have both ipv4 and ipv6 address, be sure that both of them are properly set. Doing every check against ipv4 when you present yourself to the world with ipv6 is nothing but pointless. :)

share|improve this answer

If normal emails are working fine but system emails (such as "There are X updates ready to apply") are being marked as spam then the problem is likely the content of the email and not external factors such as the IP address reputation, reverse DNS and SPF records.

I have seen Gmail marking a lot of those sorts of emails as spam myself and I suspect there must be some sort of spam or phishing activity that closely matches these email. Possibly compromised servers sending emails with a From: address of root@.

If you are using Google Apps for Business you can add the IP address to the whitelist which should solve the problem. You could also add a filter to Gmail to not mark these emails as spam even if you're not using Google Apps for Business.

These sorts of emails should only ever go to the administrator of the server so you won't have to ask all your customers to whitelist these types of emails or the IP address.

share|improve this answer
Yes of course, I could solve the problem for me adding the address to a whitelist, but customers may have their own php script which sends email (for example email to confirm subscription to a mailing list) and this email are marked as spam as well. Moreover, when I create a new user on the server, the system sends an email to the users with his password and instruction to use his space, all these emails are marked as spam. I would love to have a different solution than asking everybody to add the address to whitelist. :( – Zagorax Aug 28 '13 at 11:15
moreover, I just tried to send an email from command line using the mail command. I didn't use the root account but a normal one, I wrote an email with normal test (i.e. "Hi, how are you? I'm fine. Cheers") and still it was marked as spam. – Zagorax Aug 29 '13 at 18:08
- What hostname does your SMTP client use when sending EHLO command to the Google SMTP server? It should only use EHLO, because it's the reverse of the client IP. Some SMTP server may check more than existence of reverse. – Fox Aug 29 '13 at 18:23
@Fox, how do I check which hostname the SMTP client use when contacting the gmail server? I know that if I connect with telnet to my SMTP server, on the very first line it present itself as, I assume it uses the same hostname when contacting other servers. – Zagorax Aug 29 '13 at 22:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.