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 = 127.0.0.0/8 [::ffff:127.0.0.0]/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[173.194.205.108]:587, delay=67, delays=65/0.12/1.4/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[173.194.205.108] 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

I'd try other tutorials. Example: https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay/

I can't duplicate your setup so my view is to try other methods. Also, get sendmail (the command line) working as well, it repeats some items from …

Jump to Post

All 3 Replies

@rproffitt

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.

Yes, the GMAIL setup is both onerous and not optional. I don't recall if any tutorial covered that so here's Google about how to enable the relay service. https://support.google.com/a/answer/2956491?hl=en

To be clear, this is not a full fledged email server but a relay system.

Be a part of the DaniWeb community

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