Postfix is fast and popular SMTP server widely used. The main job of postfix is to relay mail locally or to the intended destination outside the network. Some of the most popular SMTP servers are Sendmail, Postfix, and Qmail. By default, Sendmail comes pre-installed with CentOS/RHEL 5. We will need to remove it and install Postfix.
You may also like:
Step 1 – Install Postfix
If Postfix not already installed on your machine, Install it using the following command. Also, remove sendmail if already installed.
yum remove sendmail yum install postfix
Make postfix as default MTA for your system using the following command
alternatives --set mta /usr/sbin/postfix
If above command not work and you get the output as “
alternatives --set mta /usr/sbin/sendmail.postfix
Step 2 – Configure Postfix
Let’s start postfix configuration. Edit Postfix configuration file /etc/postfix/main.cf in your favorite editor and make following changes.
myhostname = mail.tecadmin.net mydomain = tecadmin.net myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost, $mydomain mynetworks = 127.0.0.0/8, /32 relay_domains = $mydestination home_mailbox = Maildir/
After executing above command edit the postfix configuration file and make sure all changes are done properly.
Step 3 – Restart Postfix Service
As we have done basic Postfix configuration, So restart Postfix service to read changes of configuration. Also, configure to autostart on system boot.
service postfix restart chkconfig postfix on
Step 4 – Open Firewall Port
Now if your system is configured to use iptables firewall, So add firewall rules to make postfix accessible from outside, using following commands.
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT iptables -A INPUT -m state --state NEW -m udp -p udp --dport 25 -j ACCEPT
Thanks for using this article.
16 Comments
totally not helpful. Completely vague and unclear solution. Left too much.
Hi,
I am not sure how many of the readers were successfully able to get the Postfix started sending emails…
I followed all the steps of the article. When I try sending test mail, I get following error in the /var/log/maillog
Jul 15 12:08:46 mumsrv-qe postfix/pickup[28935]: CD221181C6E: uid=0 from=
Jul 15 12:08:46 mumsrv-qe postfix/cleanup[30412]: CD221181C6E: message-id=
Jul 15 12:08:46 mumsrv-qe postfix/qmgr[28936]: CD221181C6E: from=, size=479, nrcpt=1 (queue active)
Jul 15 12:09:28 mumsrv-qe postfix/smtp[30414]: CD221181C6E: to=, relay=mobileum.com[217.78.11.57]:25, delay=42, delays=0.11/0.01/21/21, dsn=5.0.0, status=bounced (host mobileum.com[217.78.11.57] said: 550-Please turn on SMTP Authentication in your mail client. 550-(mumsrv-qe.mobileum.com) [114.143.191.38]:43898 is not permitted to relay 550 through this server without authentication. (in reply to RCPT TO command))
Jul 15 12:09:28 mumsrv-qe postfix/cleanup[30412]: 6DAE3181C88: message-id=
Jul 15 12:09:28 mumsrv-qe postfix/bounce[30494]: CD221181C6E: sender non-delivery notification: 6DAE3181C88
Jul 15 12:09:28 mumsrv-qe postfix/qmgr[28936]: 6DAE3181C88: from=, size=2718, nrcpt=1 (queue active)
Jul 15 12:09:28 mumsrv-qe postfix/qmgr[28936]: CD221181C6E: removed
I am not sure what is missing!
Someone please help
If you’re still having issues setting up Postfix please send me an email at [email protected] This article is very vague and completely not helpful to beginners. Personnaly i would suggest to use PostgreSQL as a Database backend over MySQL. feel free to email me if you or anyone else is having trouble setting up an email server
The above information is very helpful. Thanks, Pratik
We know computer issues can happen at any time. That’s why we provide a 24-hour emergency IT support service. If you need us to resolve a frustrating IT issue after hours just call us and you will be working again in no time.
Thank For Yourt Information its very useful for me as a beginner
In Redhat 8 at least (and probably every other version/flavor), specifying a Subnet like l27.0.0.0/8, 32 will conflict with the earlier inet_interfaces=all statement. Can’t have both. Best to recomment the subnet line.
Also, this article is woefully short and inadequate. You should thoroughly configure and test Postfix before making it your MTA. If you’re gonna go to the trouble of writing a config article, do it right ffs
Really great site I Must say something I applied regarding Outbound Telemarketing Cold Calling script for answering.
Excellent. It works!
rcpt to:
550 5.1.1 : Recipient address rejected: User unknown in local recipient table
i receive above error please help to find out
There is a Spelling Mistake serivce postfix restart it is service postfix restart
Thanks kazuya…
Is that all you noticed here Kazuya??
not sent outgoing mail ( gmail or hotmail.com )
local mail are sent but not outgoing
what can i do i am using centos 6.5 32 bit
Wouldn’t it be better to configure Postfix *before* making it your MTA?
hello!this is extremely good site!
Excellent goods from you, man. I’ve understand your stuff previous to and you’re just extremely magnificent.