Relai smtp

De wikiGite

Exemple d'utilisation de gmail comme relay smtp

Installation de postfix

aptitude install postfix libsasl2-2 ca-certificates libsasl2-modules

Configuration

vim /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

Mot de passe

ajouter le login et le mot de passe dans le fichier /etc/postfix/sasl_passwd

[smtp.gmail.com]:587    user.name@gmail.com:password

Droits

chmod 400 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd

Certificat

cat /etc/ssl/certs/ssl-cert-snakeoil.pem | sudo tee -a /etc/postfix/cacert.pem