This question already has an answer here:

I've been trying for a long time to get our company's mail server send mail that will get accepted by the GMail spam filter. I have managed making it work for Yahoo Mail and Hotmail, sadly GMail is still marking our mails as spam.

I have configured DKIM, SPF, DMARC and verified our mail server IP address against blacklists. I also have pasted here the headers GMail gets when we send a mail.

Delivered-To: gmail-test-account@gmail.com
Received: by with SMTP id hc6csp107427icb;
        Wed, 20 Aug 2014 07:34:26 -0700 (PDT)
X-Received: by with SMTP id ev2mr59101019wjb.76.1408545265402;
        Wed, 20 Aug 2014 07:34:25 -0700 (PDT)
Return-Path: <company@phyramid.com>
Received: from mail.phyramid.com (mail.phyramid.com. [])
        by mx.google.com with ESMTPS id dj10si4827754wib.79.2014.
        for <gmail-test-account@gmail.com>
        (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 20 Aug 2014 07:34:25 -0700 (PDT)
Received-SPF: pass (google.com: domain of company@phyramid.com designates as permitted sender) client-ip=;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of company@phyramid.com designates as permitted sender) smtp.mail=company@phyramid.com;
       dkim=pass header.i=@phyramid.com
Received: from localhost (localhost [])
  by mail.phyramid.com (Postfix) with ESMTP id ED2BB2017AC
  for <gmail-test-account@gmail.com>; Wed, 20 Aug 2014 17:33:23 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phyramid.com; h=
  :message-id:to:from:from:date:date; s=dkim; t=1408545197; x=
  1409409197; bh=e04RtoyF7G39lfCvA9LLhTz4nF64siZtN5IYmC18Xsc=; b=o
X-Amavis-Modified: Mail body modified (using disclaimer) - mail.phyramid.com
X-Virus-Scanned: Debian amavisd-new at mail.phyramid.com
Received: from mail.phyramid.com ([])
  by localhost (mail.phyramid.com []) (amavisd-new, port 10024)
  with ESMTP id 3JcgXZAXeFtX for <gmail-test-account@gmail.com>;
  Wed, 20 Aug 2014 17:33:17 +0300 (EEST)
Received: from whiterock.local (unknown [])
  by mail.phyramid.com (Postfix) with ESMTPSA id 05CAE200280
  for <gmail-test-account@gmail.com>; Wed, 20 Aug 2014 17:33:15 +0300 (EEST)
Date: Wed, 20 Aug 2014 17:34:15 +0300
From: Company Mail <company@phyramid.com>
To: gmail-test-account@gmail.com
Message-ID: <etPan.53f4b8b8.46e87ccd.11669@whiterock.local>
Subject: hey there!
X-Mailer: Airmail (247)
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

How was your summer?


Thanks a lot!

marked as duplicate by MadHatter, EEAA, mailq, Jenny D, Ward Aug 21 '14 at 15:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It said "Why is this message in Spam? It contains content that's typically used in spam messages.", thanks! – Petru Toader Aug 20 '14 at 14:57
  • The Message-ID looks suspicious. – David Schwartz Aug 20 '14 at 15:15
  • is in UCEProtectL3. I doubt that matters. – David Schwartz Aug 20 '14 at 15:27
  • Subject: hey there! looks very much like spam. – richardb Aug 20 '14 at 15:37
  • Try sending something that more closely resembles a real message. – Michael Hampton Aug 20 '14 at 20:58

I have seen this to happen in other ocasions, when the received from is reported as localhost, with as IP address.

The fact that this does not match with your DNS records is certainly getting your email marked as spam.

You should review your DNS records (A and MX) and the headers that you send in your SMTP server. Your server is sending what it believe it is his IP address, so you will need to configure your /etc/hosts to let your server know what is the external IP address of your server.


If you're sending almost identical mails to more than 1 recipient, the single 2 most important headers to have, when dealing with GMail are:

Precedence: bulk


List-Unsubscribe: http://your-site.com/unsubscribe.php?email=thisguy@gmail.com

of course pointing to a real and working unsubscribe page, where google's unsubscribe bot can easily get to click unsubscribe with out being bothered by strange javascript or captchas or the likes.

See more at Google bulk senders guidelines

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