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

From Bitbull Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
  
 
/etc/init.d/postfix restart
 
/etc/init.d/postfix restart
 
+
</pre>
  
 
==WITH TLS==
 
==WITH TLS==
Line 39: Line 39:
 
/etc/init.d/postfix restart
 
/etc/init.d/postfix restart
 
</pre>
 
</pre>
 +
 +
[[Category:Linux]]
 +
 
==CHANGE SYSTEM SENDER==
 
==CHANGE SYSTEM SENDER==
 
<pre>
 
<pre>
Line 51: Line 54:
 
/^.*localdomain.*/    send@mydomain.com
 
/^.*localdomain.*/    send@mydomain.com
 
---
 
---
 +
</pre>
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Latest 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

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
---