Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've a CentOS 6.4 server with DirectAdmin. 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 158.58.168.96
96.168.58.158.in-addr.arpa domain name pointer fs1.francescoruvolo.com.

$ host fs1.francescoruvolo.com
fs1.francescoruvolo.com has address 158.58.168.96
fs1.francescoruvolo.com mail is handled by 10 mail.fs1.francescoruvolo.com.

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

Delivered-To: *******@gmail.com
Received: by 10.70.8.133 with SMTP id r5csp188653pda;
        Mon, 26 Aug 2013 18:50:19 -0700 (PDT)
X-Received: by 10.15.64.1 with SMTP id n1mr30567514eex.15.1377568217754;
        Mon, 26 Aug 2013 18:50:17 -0700 (PDT)
Return-Path: <root@fs1.francescoruvolo.com>
Received: from fs1.francescoruvolo.com ([2a02:29e0:2:4::b5b6:f0bd])
        by mx.google.com with ESMTPS id q8si12101539eem.60.1969.12.31.16.00.00
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Mon, 26 Aug 2013 18:50:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of root@fs1.francescoruvolo.com designates 2a02:29e0:2:4::b5b6:f0bd as permitted sender) client-ip=2a02:29e0:2:4::b5b6:f0bd;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of root@fs1.francescoruvolo.com designates 2a02:29e0:2:4::b5b6:f0bd as permitted sender) smtp.mail=root@fs1.francescoruvolo.com
Received: from root by fs1.francescoruvolo.com with local (Exim 4.76)
    (envelope-from <root@fs1.francescoruvolo.com>)
    id 1VE8Q9-0005lK-Q8
    for *******@gmail.com; Tue, 27 Aug 2013 03:50:13 +0200
Date: Tue, 27 Aug 2013 03:50:13 +0200
To: *******@gmail.com
Subject: 1 updates available for fs1.francescoruvolo.com
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: <E1VE8Q9-0005lK-Q8@fs1.francescoruvolo.com>
From: root <root@fs1.francescoruvolo.com>

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
add comment

2 Answers

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 fs1.francescoruvolo.com, 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 fs1.francescoruvolo.com, I assume it uses the same hostname when contacting other servers. –  Zagorax Aug 29 '13 at 22:43
add comment
up vote 0 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
add comment

Your Answer

 
discard

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.