Problems with Gmail in default Postfix configuration

Recently I moved some of the sites to a new hosting. The previous server had Ubuntu 12.04 with Exim4 and I forgot how to configure them.

On a new server I installed Postfix with Ansible:

    - name: Set up Postfix to relay mail
      debconf: name=postfix
               question='{{ item.question }}'
               value='{{ item.value }}'
               vtype='{{ item.vtype }}'
        - { question: 'postfix/mailname', value: '{{ ansible_fqdn }}', vtype: 'string' }
        - { question: 'postfix/main_mailer_type', value: 'Internet Site', vtype: 'string' }

After that I started to receive the next delivery reports from Gmail:

Action: failed
Status: 5.7.1
Remote-MTA: dns;
Diagnostic-Code: smtp; 550-5.7.1 This message does not have authentication
    information or fails to pass 550-5.7.1 authentication checks. To best
    protect our users from spam, the 550-5.7.1 message has been blocked. Please
    visit 550-5.7.1 for more 550
    5.7.1 information. d86si3833724ljf.339 - gsmtp

I solved this with inet_protocols = ipv4 setting in the /etc/postfix/ After that, the reports are gone, but some emails started to go to the spam. It can be solved with set up a SPF, DKIM, PTR records and so on. But since I already used Mailgun in one of the projects, I configured Postfix to use it also. It’s just a few lines and everything works.

relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps =
smtp_sasl_security_options = noanonymous
comments powered by Disqus