Mail/MTA/Postfix/GmailRelay

De TartareFR
Aller à la navigation Aller à la recherche

Modify postfix configuration

Edit /etc/postfix/main.cf

# sets gmail as relay
relayhost = [smtp.gmail.com]:587

#  use tls
smtp_use_tls=yes

# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes

# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.trust.crt

# eliminates default security options which are imcompatible with gmail
smtp_sasl_security_options =

If you need further debugging you can add these:

debug_peer_list=smtp.gmail.com
debug_peer_level=3

Set Gmail credentials

Add Gmail credentials to /etc/postfix/sasl_passwd

[smtp.gmail.com]:587  username:password

and create database

postmap /etc/postfix/sasl_passwd

Reload postfix service

systemctl reload postfix