I build websites within a private home-office network.
Locally hosted website are development versions of sites that I build for clients.
I want the websites that I am building to be able to send emails. And I want to test email capability from the local development versions of the sites within my office network.
My dev server is running Ubuntu 22.04
I am configuring postfix as a send-only server. I'd like to use gmails smtp service as a relay.
This is what I have done so far:
In my Google admin, I have enabled less secure apps.
(I'm aware that they are phasing this out for some users, but I'm a Google Workspace user and I believe that 'less secure apps' will continue to work for us. Do tell me if I'm wrong.)
I've put my credentials in /etc/sasl_password in this format:
[smtp.gmail.com]:587 myemailaddress@mydomain:mypassword
- I've edited /etc/postfix/main.conf to include these lines:
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
I've used the 'postmap' command to add the password file to postmap's database:
postmap /etc/postfix/sasl_passwd
When I run 'postfix check' there is no return. No errors or warnings (or anything else) are displayed.
I've restarted the postfix server
After restarting I send a test mail from one of my development sites.
The mail log tells me that mail has been refused because of an authentication failure. The relevant line is:
status=deferred (SASL authentication failed; cannot authenticate to server smtp.gmail.com[142.251.10.109]: invalid parameter supplied)
What am I missing?