{"id":87,"date":"2015-06-09T10:53:14","date_gmt":"2015-06-09T10:53:14","guid":{"rendered":"http:\/\/star.genuinewebhost.com\/~linuxguru\/tutorial\/?p=87"},"modified":"2025-07-10T03:20:55","modified_gmt":"2025-07-10T03:20:55","slug":"configure-postfix-mail-server-in-a-centos-7-or-redhat-7","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=87","title":{"rendered":"Configure PostFix mail server in a CentOS 7 or RHEL 7"},"content":{"rendered":"<p>Ensure that sendmail is stopped in the host<\/p>\n<ul>\n<li><strong>systemctl stop sendmail<\/strong><\/li>\n<li><strong>systemctl disable sendmail<\/strong><\/li>\n<\/ul>\n<p>Install the postfix package<\/p>\n<ul>\n<li>yum install postfix<\/li>\n<\/ul>\n<p>Backup the main postfix configuration file in case it is required for future use<\/p>\n<ul>\n<li><strong>cp \/etc\/postfix\/main.cf \/etc\/postfix\/main.cf.orig<\/strong><\/li>\n<\/ul>\n<p>Edit the configuration file<\/p>\n<ul>\n<li><strong>vi \/etc\/postfix\/main.cf<\/strong><\/li>\n<\/ul>\n<p>Ensure that the following are enabled, and <span style=\"color: #008000;\">other similar entry is commented<\/span><\/p>\n<p>========<\/p>\n<ul>\n<li>myhostname = &lt;your FQDN&gt;<\/li>\n<li>mydomain = &lt;your FQDN&gt;<\/li>\n<li>myorigin = $myhostname<\/li>\n<li>inet_interfaces = all<\/li>\n<li>mynetworks = &lt;your IP\/subnet&gt;, 127.0.0.0\/8<\/li>\n<li>home_mailbox = Maildir\/<\/li>\n<\/ul>\n<p>=======<\/p>\n<p>Restart postfix<\/p>\n<ul>\n<li><strong>systemctl restart postfix<\/strong><\/li>\n<\/ul>\n<p>Verify if SMTP is working<\/p>\n<ul>\n<li><strong>netstat -na | grep 25<\/strong><\/li>\n<\/ul>\n<p>If it is working make sure sendmail, or any other SMTP service is not installed<\/p>\n<p>Start the postfix service<\/p>\n<ul>\n<li><strong>systemctl start postfix<\/strong><\/li>\n<li><strong>systemctl enable postfix<\/strong><\/li>\n<\/ul>\n<p>Verify if the SMTP service is running<\/p>\n<ul>\n<li><strong>netstat -na | grep 25<\/strong><\/li>\n<\/ul>\n<p><strong><em>Note:<\/em><\/strong> The server will send mail only to users in its domain !!<\/p>\n<p>====== ===== ====== ===== ====== =====<\/p>\n<p>Let us test if the server is working fine.<\/p>\n<p>Create a new user called &#8220;anyuser&#8221;<\/p>\n<ul>\n<li><strong>useradd anyuser<\/strong><\/li>\n<\/ul>\n<p>Do a telnet session to SMTP server<\/p>\n<ul>\n<li>[root@host ~]# telnet localhost 25<\/li>\n<li>Trying ::1&#8230;<\/li>\n<li>Connected to localhost.<\/li>\n<li>Escape character is &#8216;^]&#8217;.<\/li>\n<li>220 &lt;my FQDN&gt; ESMTP Postfix<\/li>\n<li>ehlo &lt;my FQDN&gt;<\/li>\n<li>250-&lt;my FQDN&gt;<\/li>\n<li>250-PIPELINING<\/li>\n<li>250-SIZE 10240000<\/li>\n<li>250-VRFY<\/li>\n<li>250-ETRN<\/li>\n<li>250-ENHANCEDSTATUSCODES<\/li>\n<li>250-8BITMIME<\/li>\n<li>250 DSN<\/li>\n<li>MAIL FROM: root@&lt;my FQDN&gt;<\/li>\n<li>250 2.1.0 Ok<\/li>\n<li>RCPT TO: &lt;anyuser@my FQDN&gt;<\/li>\n<li>250 2.1.5 Ok<\/li>\n<li>DATA<\/li>\n<li>354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<\/li>\n<li>Hello anyuser<\/li>\n<li>.<\/li>\n<li>quit<\/li>\n<\/ul>\n<p>Go to the home folder of the anyuser and check if the Maildir folder is automatically created, and the file file is there.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Ensure that sendmail is stopped in the host systemctl stop sendmail systemctl disable sendmail Install the postfix package yum install postfix Backup the main postfix <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=87\" title=\"Configure PostFix mail server in a CentOS 7 or RHEL 7\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":1819,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,7],"tags":[],"class_list":["post-87","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-postfix"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87"}],"version-history":[{"count":14,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":886,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions\/886"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/1819"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}