【转】Linux 下搭建Postfix邮件服务器详解:,postfix邮件服务器


在我自己的服务器上面搭建了邮件服务器,为的是接下来写shell脚本进行报警监控。当服务器发生意外,可以及时发送邮件服务器到邮箱。

看了两个教程,按照两个教程来搭建的,感谢原作。

Linux 下搭建Postfix邮件服务器详解:

1、首先关闭sendmail服务

service sendmail stop

2、chkconfig sendmail off(关闭开机自启动)

3、修改DNS正解文件,使DNS能够解析邮箱服务

添加下面两行

mail.zhubf.com. IN A            172.17.17.2

zhubf.com.      IN MX  10      mail.zhubf.com.

重启DNS服务

service named  restart

chkconfig named on

echo "" > /etc/resolv.conf

测试DNS设置是否正确

host mail.zhubf.com

mail.zhubf.com has address 172.17.17.2

4安装postfix 软件包(前提安装yum,配置yum源)

yum install -y postfix

修改postfix配置文件

vim /etc/postfix/main.cf

主要内容如下

5、配置saslauthd,这个软件默认是安装的

修改saslauthd 配置文件

vi /etc/sysconfig/saslauthd

设置MECH=shadow

service saslauthd restart

chkconfig saslauthd on

创建邮箱用户

useradd zhubf

passwd  zhubf

echo zhubf |passwd --stdin zhubf

进行密码验证测试

testsaslauthd -u zhubf -p 'zhubf'

0: OK "Success."

若没有通过,可能是防火墙或selinux的设置问题。

在postfix的主配置文件/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

重启postfix 服务

service postfix restart

chkconfig postfix on

另外一个辅助教程是:http://www.cnblogs.com/dudu/archive/2012/12/12/linux-postfix-mailserver.html

写得很好。

相关内容