Difference between revisions of "Postfix Mail relaying with smtp auth"

From Bitbull Wiki
Jump to navigation Jump to search
Line 51: Line 51:
 
/^.*localdomain.*/    send@mydomain.com
 
/^.*localdomain.*/    send@mydomain.com
 
---
 
---
 +
</pre>
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Revision as of 12:04, 30 September 2021

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


==WITH TLS==
<pre>
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.2 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
---