Cant send emails to gmail

I have looked at previous posts but most are old and GMAIL keeps changing everything. I followed the instructions, added APP passwords and used the password in the settings for freepbx but still cant send emails. I ran debug and the response from gmail was “must use app specific password” which I was doing! Anyone get this working mor recently that years ago?

Gmail turned off basic user/pass auth last month:

This is probably what’s going on in this recently revived topic:

Working on transition to OAuth for forum email reply support as well…

I found another post that I got working although I dont know for how long…

go into your gmail account and create an app password
on your freepbx
edit the file /etc/postfix/main.cf and add the following to the bottom of the file (some may be there already)

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = secure
smtp_sasl_type = cyrus
smtp_use_tls = yes
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
relayhost = smtp.gmail.com:587

then edit /etc/postfix/sasl_password (don’t include the “”) you can also set these via the GUI on the email settings screen.

smtp.gmail.com:587 “email address”:“app password”

then run the following commands

postmap hash:/etc/postfix/sasl_passwd
postfix reload
chmod 400 /etc/postfix/sasl_passwd

in my case I had to reboot the pbx after this to clear the email queue. Not sure if it would have cleared over time? I am now getting notices from the PBX and voicemails are going to emails.