I have set up a POSTFIX server on my VPS and mail sent trough it is going to Spam in gmail. Here is my message:

Delivered-To: [email protected]
Received: by with SMTP id d69csp350632qga;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
X-Received: by with SMTP id bl7mr6149887wjb.76.1421710169272;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
Return-Path: <[email protected]>
Received: from mail.sgenov.com (mail.sgenov.com. [])
        by mx.google.com with ESMTP id j9si29338582wjy.109.2015.
        for <[email protected]>;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
Received-SPF: pass (google.com: domain of [email protected] designates as permitted sender) client-ip=;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of [email protected] designates as permitted sender) [email protected];
       dkim=pass [email protected]
Received: by mail.sgenov.com (Postfix, from userid 33)
    id 665FB44097; Tue, 20 Jan 2015 01:29:28 +0200 (EET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hotelfors-bg.com;
    s=default; t=1421710168;
To: <[email protected]>
Subject: Hello, Stanimir
X-PHP-Originating-Script: 0:main.inc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
Content-Transfer-Encoding: 7bit
Date: Tue, 20 Jan 2015 01:29:28 +0200
From: [email protected]
Message-ID: <[email protected]>
X-Sender: [email protected]
User-Agent: Roundcube Webmail/0.7.2

This is my new email. Please add it to contacts and reach me if you 
need anything.

Best Regards

As you can see, my mail server is set up with the following:

  • The server has DKIM
  • The server has a verified signed certificate
  • SPF(TXT) is set correctly
  • The server's PTR (reverse DNS) points correctly to my mail server
  • All possible checking tools give a maximum result for the server (it should be trusted by everyone)

Yet, gmail sends all messages from all domains to spam. Does anyone know what the reason could be or what steps I should take? Can I contact someone?

Thanks in advance.

  • Why did Gmail say it went to spam? Jan 19, 2015 at 23:45
  • It says "Because it looks like other messages that were marked as spam" .. but the server is mine and I am 100% sure no spam was sent to anyone
    – DreamWave
    Jan 19, 2015 at 23:49
  • 3
    Google has no requirement to accept your email or to deliver it to the recipients mailbox, regardless of what measures you've taken to ensure that your email server is on the "up and up". Everything you've done is well and good and is considered best practice but at the end of the day it's a shot in the dark. There's now law, rule or policy that states that anyone has to accept email from anyone else. My suggestion would be to go here and submit a delivery problem report. - support.google.com/mail/contact/msgdelivery
    – joeqwerty
    Jan 20, 2015 at 0:19
  • Many people has same problem wiht you as you can see related question like above in right sidebar i.imgur.com/9Cxv7mR.png . For example this question has similar requirement Postfix sends email to spam (gmail, hotmail)
    – masegaloeh
    Jan 20, 2015 at 0:30
  • Thank you for pointing that out, but that question has no significant answers
    – DreamWave
    Jan 20, 2015 at 8:50

1 Answer 1


Not sure the solution below is an option for you but it works for me as I had a similar issue. I am using a transport map to selectively choose mails with @gmail.com as destination address and relay them via smtp.gmail.com using my G-Mail credentials for authentication.

Here are the steps:

Add the entry below to /etc/postfix/transport

gmail.com smtp:[smtp.gmail.com]

Add an entry below to /etc/postfix/sasl_passwd

[smtp.gmail.com]:587            [email protected]:<your_gmail_password_here>

Add the following entries to /etc/postfix/main.cf

transport_maps = hash:/etc/postfix/transport
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtp_use_tls = yes

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/transport
  • This is awesome! While it does not resolve the main problem, I was just looking for external SMTP services. I found one but it is only limited to 200/day (for free). If I relay only messages going to gmail that might be enough for my case. THANK YOU!
    – DreamWave
    Jan 20, 2015 at 8:52
  • You are welcome. I believe gmail also has a 200 or so per day limit but if you just do gmail only, it may be sufficient since you can directly deliver the rest. My postfix is a personal/family mail server so I never ran into gmail limit because I do 3 or 4 messages per day via gmail. BTW: you have done a great job of postfix configuration (dkim,spf,etc). If you need add spam filtering techniques, I'd be happy to provide the rules/techniques I use. You can see the rules/techniques in action here: selvans.net/mta_errors.html and selvans.net/mail_rejects.html Jan 20, 2015 at 13:59
  • I can't get this to work :/ stackoverflow.com/questions/46863330/… Oct 21, 2017 at 12:43

Not the answer you're looking for? Browse other questions tagged .