How to change built in email to Gmail

I’ve recently changed ISP that blocks port 25 therefore, no more emails from FreepBX using the built in email. So I’ve changed it to Gmail and here is what I did.

In /etc/postfix/main.cf find the line

If you’re connected via UUCP, see also the default_transport parameter.

and add after it the following under it

relayhost = smtp.googlemail.com:587
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_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

save that and then issue the command
postfix reload

Create a file in /etc/postfix/sasl_passwd and add
smtp.googlemail.com [email protected]:YOURPASSWORD

You need to create YOURPASSWORD in the Google 2FA Gmail app password

Then issue a
postmap hash:/etc/postfix/sasl_passwd
which will create a file named sasl_passwd.db

issue another
postfix reload
for good measure

Than finally Set permissions with
chmod 400 /etc/postfix/sasl_passwd

and your done. Changed to Gmail for emails.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.