CentOS, Postfix, opendkim, SPF, mail going to span for gmail


I have spent the last three day’s trying my very best to get my email services working correctly. Unfortunately mail sent to gmail is going to spam. I have tried all I can think of including:

  • Setting up an SPF record
  • Setting up opendkim

Here is a mail header: Delivered-To: Received: by with SMTP id dt2csp205769qab; Tue, 29 Apr 2014 16:51:59 -0700 (PDT) Received: from ( []) by with ESMTP id 5si10316402qch.25.2014. for; Tue, 29 Apr 2014 16:51:58 -0700 (PDT) Received: by (Postfix, from userid 502) id 7D9AF83EDF; Tue, 29 Apr 2014 19:51:56 -0400 (EDT) X-Received: by with SMTP id h4mr935288qaq.35.1398815519466; Tue, 29 Apr 2014 16:51:59 -0700 (PDT) Return-Path: Received-Spf: pass ( domain of designates as permitted sender) client-ip=; Authentication-Results:; spf=pass ( domain of designates as permitted sender); dkim=pass Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=email; t=1398815516; bh=/5uwtCczjhI3dGKtrYQWaePMjha4qCzOSEcspbECRkU=; h=Date:To:Subject:From; b=xOtocT3eBlaG53IagQaYPmoMLhmvud3LGzHgWOk17gQcl4Cj3c1qyFT9Ci/fc/Y3L DMBYgN4m2Xn+D24tVBBX7TF6oniTJnhSOVuGYhg1gM5AzopcUGuykwKz0NJtIGMPjs TqYL1AhzoylPn3VrsYuyW0htl/9IGZU+XQw1zJoI= 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: Over this

And here is a my SPF record: v=spf1 a mx ptr ip4: ~all

And an extract from my maillog Apr 29 19:29:04 duprod postfix/pickup[407]: 810E583EE0: uid=502 from=<community> Apr 29 19:29:04 duprod postfix/cleanup[1131]: 810E583EE0: Apr 29 19:29:04 duprod opendkim[30104]: 810E583EE0: DKIM-Signature field added (s=email, Apr 29 19:29:04 duprod postfix/qmgr[30207]: 810E583EE0:, size=489, nrcpt=1 (queue active) Apr 29 19:29:05 duprod postfix/smtp[1134]: 810E583EE0:,[]:25, delay=1.4, delays=0.09/0.01/0.46/0.85, dsn=2.0.0, status=sent (250 2.0.0 OK 1398814147 g2si4067389qaf.20 - gsmtp)

I really need to get this going, so any help would be appreciated…

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

emails sent from my mail server never go to Spam folder. My DNS looks like this: <br>@ IN A your-ip <br>mail CNAME @ <br>@ TXT “v=spf1 ip4:your-ip -all” <br> <br>Try to add a TXT and remove the SPF record. Remember to wait for a DNS refresh and try it.

So does this mean that the only effective way to send mail to a gmail/google account is to subscribe to a paid service? Mail forms a critical function in my application and I need it to be rock solid.

Hi there, <br> <br>Sadly, this is an often common side effect of running your own mail server… There are services you can look into so that you are not self-hosting and being snagged by spam detection from the major providers. However, more often than not this is the anticipated functions of their spam filters.