3

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: sgenov@gmail.com
Received: by 10.140.43.75 with SMTP id d69csp350632qga;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
X-Received: by 10.194.89.39 with SMTP id bl7mr6149887wjb.76.1421710169272;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
Return-Path: <kalina@hotelfors-bg.com>
Received: from mail.sgenov.com (mail.sgenov.com. [192.81.221.174])
        by mx.google.com with ESMTP id j9si29338582wjy.109.2015.01.19.15.29.28
        for <sgenov@gmail.com>;
        Mon, 19 Jan 2015 15:29:29 -0800 (PST)
Received-SPF: pass (google.com: domain of kalina@hotelfors-bg.com designates 192.81.221.174 as permitted sender) client-ip=192.81.221.174;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of kalina@hotelfors-bg.com designates 192.81.221.174 as permitted sender) smtp.mail=kalina@hotelfors-bg.com;
       dkim=pass header.i=@hotelfors-bg.com
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;
    bh=ZOL1SsCcV0ncUnB8HJhFqzY/7ZocyZVCh5HCRSTXejY=;
    h=To:Subject:Date:From;
    b=TjCDSt9mOFyoXVGu4CI7xqPxR7iHMtzeL1Nykd+t0cZBlWEH15OQQVdkDR07G4xJH
     WvKPQAFBHPVynQNYbnsRnwf4A57elvUImo77MDLZGhNGrS70fYdIjEjKAWe8BLX61G
     1GuaBLPfJYYUz6SdVjYsBPNm/io2wrWc63Sdvb1M=
To: <sgenov@gmail.com>
Subject: Hello, Stanimir
X-PHP-Originating-Script: 0:main.inc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Tue, 20 Jan 2015 01:29:28 +0200
From: kalina@hotelfors-bg.com
Message-ID: <f5944a29798c926bf52fda46c4197c76@hotelfors-bg.com>
X-Sender: kalina@hotelfors-bg.com
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.

DreamWave
  • 149
  • 1
  • 1
  • 5
  • Why did Gmail say it went to spam? – Michael Hampton Jan 19 '15 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 '15 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. - https://support.google.com/mail/contact/msgdelivery – joeqwerty Jan 20 '15 at 00:19
  • Many people has same problem wiht you as you can see related question like above in right sidebar http://i.imgur.com/9Cxv7mR.png . For example this question has similar requirement [Postfix sends email to spam (gmail, hotmail)](http://serverfault.com/questions/602681/postfix-sends-email-to-spam-gmail-hotmail) – masegaloeh Jan 20 '15 at 00:30
  • Thank you for pointing that out, but that question has no significant answers – DreamWave Jan 20 '15 at 08:50
  • @PeterHorvath, please elaborate – DreamWave Jan 20 '15 at 11:00

1 Answers1

4

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            sgenov@gmail.com:<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
Arul Selvan
  • 1,338
  • 12
  • 11
  • 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 '15 at 08: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: http://selvans.net/mta_errors.html and http://selvans.net/mail_rejects.html – Arul Selvan Jan 20 '15 at 13:59
  • I can't get this to work :/ https://stackoverflow.com/questions/46863330/authentication-required-when-sending-email-via-gmails-smtp-server – Atte Juvonen Oct 21 '17 at 12:43