Postfix Mail relaying with smtp auth

From Bitbull Wiki
Revision as of 12:04, 30 September 2021 by Chris (talk | contribs) (→‎SMTP AUTH)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

1 notice

this is a sample config to enable mail sending for system mails or forward mails from mailserver by smtp-auth.

2 howto

2.1 SMTP AUTH

vi /etc/postfix/password
---
#smtp.isp.com       username:password
smtp.mydomain.com         send-user@mydomain.com:mySecretePassword
---

chown root:root /etc/postfix/password
chmod 0600 /etc/postfix/password
postmap hash:/etc/postfix/password

vi /etc/postfix/main.cf
---
relayhost = smtp.mydomain.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password
smtp_sasl_security_options =
---

/etc/init.d/postfix restart

2.2 WITH TLS

yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain


vi /etc/postfix/main.cf
---
smtp_enforce_tls = yes
smtp_tls_security_level = encrypt
---

/etc/init.d/postfix restart

2.3 CHANGE SYSTEM SENDER

vi /etc/postfix/main.cf
---
sender_canonical_maps = regexp:/etc/postfix/canonical
---

vi /etc/postfix/canonical
---
/^.*localhost.*/      send@mydomain.com
/^.*localdomain.*/    send@mydomain.com
---