I am trying to set-up Postfix on my Ubuntu local web development machine for send-only e-mails using Gmail so I can test e-mails sent by a web app I am developing.

These are the steps I have followed based on a recently posted tutorial found here:

  1. Dowloaded and installed Postfix using "Internet Site" option
    The FQDN I am using is 'lhdwlamb.com'. This also appears in /etc/hosts . Excerpts of the configuration file where specified edits are needed:

    myhostname = daniel-wsT7500
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = $myhostname, lhdwlamb.com, daniel-wsT7500, localhost.localdomain, loc$
    relayhost = [smtp.gmail.com]:587
    mynetworks = [::ffff:]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = all

    #Enable SASL authentication
    smtp_sasl_auth_enable = yes
    smtp_sasl_security_options = noanonymous
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
    smtp_tls_security_level = encrypt
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

  2. Obtained a Google App Password
    This is a step I found missing from several other tutorials I found. For Google account settings 2-step verification is on when using Google App password. I have also tried the old method of my regular gmail password with allow less secure apps turned on.

  3. Created as sasl_passwd file

    [smtp.gmail.com]:587 xxxxxxx@gmail.com:xxxxxxxxxxxx

(x's replace actual values for security here)

  1. The sasl_passwd file is converted to a db using sudo postmap

  2. Files sasl_passwd and sasl_passwd.db changed to root and 0600 as listed:

    ll /etc/postfix/sasl/
    total 12
    -rw------- 1 root root 55 Jan 31 17:06 sasl_passwd
    -rw------- 1 root root 12288 Jan 31 17:09 sasl_passwd.db

  3. Postfix was restarted using sudo systemctl restart postfix.

Test e-mails are not receiving by GMail. This is the result I am seeing in mail.log (xxx's for security here):

Jan 31 16:39:51 daniel-wsT7500 postfix/smtp[28260]: E8545E1313: to=<xxxxxxx@gmail.com>, relay=smtp.gmail.com[]:587, delay=67, delays=65/0.12/1.4/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials o5sm12089476qko.85 - gsmtp)

I have looked at the page for the link in that error message and not found anything to help with this problem.

Can anyone help with information I am missing or other problems to test for?

Thanks for taking the time to read this.

Recommended Answers

All 3 Replies


Tried the tutorial you suggested. No joy. I have tried several tutorials aside from the one mentioned in my original post. I cited that one for it was the most recent and the only to mention a Google App password which I think is important given how Google has tightened credentials that use its products like Grive for Google Drive, postfix, etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.