[Switch] how to set up a Postfix email server in Linux: postfix email server
I set up an email server on my own server to write a shell script for alarm monitoring. When an accident occurs on the server, you can send the email server to your mailbox in time.
I have read two tutorials and constructed them according to the two tutorials. Thank you for the original work.
How to Set up a Postfix email server in Linux:
1. First disable the sendmail service
Service sendmail stop
2. chkconfig sendmail off (disable auto-start upon startup)
3. Modify the DNS resolution file so that DNS can resolve the mailbox service.
Add the following two lines
Mail.zhubf.com. in a 172.17.17.2
Zhubf.com. in mx 10 mail.zhubf.com.
Restart DNS
Service named restart
Chkconfig named on
Echo "">/etc/resolv. conf
Test whether DNS settings are correct.
Host mail.zhubf.com
Mail.zhubf.com has address 172.17.17.2
4. Install the postfix package (install yum and configure the yum source)
Yum install-y postfix
Modify the postfix configuration file
Vim/etc/postfix/main. cf
The main content is as follows:
5. Configure saslauthd. This software is installed by default.
Modify the saslauthd configuration file
Vi/etc/sysconfig/saslauthd
Set MECH = shadow
Service saslauthd restart
Chkconfig saslauthd on
Create an email user
Useradd zhubf
Passwd zhubf
Echo zhubf | passwd -- stdin zhubf
Password verification test
Testsaslauthd-u zhubf-p 'zhubf'
0: OK "Success ."
If it fails, it may be a firewall or selinux setting problem.
Add the following permission settings to the postfix master configuration file/etc/postfix/main. cf:
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_local_domain =''
Smtpd_recipient_restrictions =
Permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Broken_sasl_auth_clients = yes
Smtpd_client_restrictions = permit_sasl_authenticated
Smtpd_sasl_security_options = noanonymous
Restart the postfix Service
Service postfix restart
Chkconfig postfix on
Another helper tutorial is: http://www.cnblogs.com/dudu/archive/2012/12/12/linux-postfix-mailserver.html
Well written.