Last active
September 10, 2018 08:33
-
-
Save daubac402/0e0f8a4296858dac9b775ba3cd390310 to your computer and use it in GitHub Desktop.
Install & config postfix on CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1 - Install | |
# 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 “/usr/sbin/postfix has not been configured as an alternative for mta“. Use below command to do the same else skip it | |
# alternatives --set mta /usr/sbin/sendmail.postfix | |
Step 2 - Config /etc/postfix/main.cf | |
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/ | |
Step 3 – Restart Postfix Service | |
# service postfix restart | |
# chkconfig postfix on | |
Step 4 – Open Firewall Port | |
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 | |
Step 5 - Test | |
# php -a | |
# mail ('[email protected]', "Test Postfix", "Test mail from postfix"); | |
# exit (); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment