{"id":465,"date":"2019-08-17T19:03:44","date_gmt":"2019-08-17T19:03:44","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=465"},"modified":"2019-08-17T19:03:44","modified_gmt":"2019-08-17T19:03:44","slug":"how-to-setup-postfix-relay-with-authentication-in-centos-7","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/how-to-setup-postfix-relay-with-authentication-in-centos-7.html","title":{"rendered":"How to setup Postfix relay with authentication in CentOS 7"},"content":{"rendered":"\n<p>To configure postfix to relay mail using another MTA, you may do the following steps:<\/p>\n\n\n\n<p><code>postconf -e 'relayhost = smtp.to.relay.com'<br>postconf -e 'smtp_sasl_auth_enable = yes'<br>postconf -e 'smtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd'<br>postconf -e 'smtp_sasl_security_options='<\/code><\/p>\n\n\n\n<p>Replace <code>smtp.to.relay.com<\/code> with the original MTA hostname that you going to use for relaying. Now, create the <code>sasl_passwd<\/code> file in <code>\/etc\/postfix<\/code> with the following inside:<\/p>\n\n\n\n<p><code>smtp.to.relay.com   smtp_username:smtp_password<\/code><\/p>\n\n\n\n<p>Now, use postmap to generate postfix hash db:<\/p>\n\n\n\n<p><code>postmap \/etc\/postfix\/sasl_passwd<\/code><\/p>\n\n\n\n<p>You can verify if it&#8217;s working with the following:<\/p>\n\n\n\n<p><code>postmap -q smtp.to.relay.com \/etc\/postfix\/sasl_passwd<\/code><\/p>\n\n\n\n<p>This will return the username and password for your smtp relay host.<\/p>\n\n\n\n<p>Now all you need to do is to restart the postfix<\/p>\n\n\n\n<p><code>service postfix restart<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To configure postfix to relay mail using another MTA, you may do the following steps: postconf -e &#8216;relayhost = smtp.to.relay.com&#8217;postconf -e &#8216;smtp_sasl_auth_enable = yes&#8217;postconf -e &#8216;smtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd&#8217;postconf -e &#8216;smtp_sasl_security_options=&#8217; Replace smtp.to.relay.com with the original MTA hostname that you going to use for relaying. Now, create the sasl_passwd file in \/etc\/postfix with the following inside: &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/how-to-setup-postfix-relay-with-authentication-in-centos-7.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to setup Postfix relay with authentication in CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[295,12,13,211,246,191],"tags":[],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/465"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=465"}],"version-history":[{"count":1,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/465\/revisions"}],"predecessor-version":[{"id":466,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/465\/revisions\/466"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}