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:
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
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.
Created as sasl_passwd file
(x's replace actual values for security here)
The sasl_passwd file is converted to a db using
Files sasl_passwd and sasl_passwd.db changed to root and 0600 as listed:
-rw------- 1 root root 55 Jan 31 17:06 sasl_passwd
-rw------- 1 root root 12288 Jan 31 17:09 sasl_passwd.db
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: E8545E1313: to=<email@example.com>, relay=smtp.gmail.com[22.214.171.124]:587, delay=67, delays=65/0.12/1.4/0, dsn=4.7.8, status=deferred (SASL authentication failed; server smtp.gmail.com[126.96.36.199] 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.