Postfix🔗
Debian/Ubuntu Postfix Install With GMAIL SMTP Relay🔗
apt-get update && apt-get install -y postfix mailutils
create/edit file:
/etc/postfix/sasl_passwd
with:
[smtp.gmail.com]:587 example.gmail.com:yourpassortoekn
save&exit
chmod 600 /etc/postfix/sasl_passwd
rm -rf /etc/postfix/main.cf
create and edit new /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
inet_interfaces = loopback-only
Run:
postmap /etc/postfix/sasl_passwd
systemctl restart postfix && systemctl enable postfix
Now test outgoing email:
echo "Testing my new postfix setup" | mail -s "Test email from `hostname`" [email protected]_address
CentOS Postfix Install With GMAIL SMTP Relay🔗
dnf update && dnf install -y postfix mailx cyrus-sasl cyrus-sasl-plain
create/edit file:
/etc/postfix/sasl_passwd
with:
[smtp.gmail.com]:587 example.gmail.com:yourpassortoekn
save&exit
chmod 600 /etc/postfix/sasl_passwd
rm -rf /etc/postfix/main.cf
create and edit new /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
inet_interfaces = loopback-only
Run:
postmap /etc/postfix/sasl_passwd
systemctl restart postfix && systemctl enable postfix
Now test outgoing email:
echo "Testing my new postfix setup" | mail -s "Test email from `hostname`" [email protected]_address