[iyunv@mail named]# cd /var/named/chroot/var/named/
[iyunv@mail named]# ls -l sheng.com.zone
-rw-r--r-- 1 named named 238 Dec 18 19:12 sheng.com.zone
可以看到: user: group 是named (说明一定要是named, 不然编译有问题)
好,下面来测试一下 sheng.com.zone 的内容:
1:把: mail IN A 192.168.11.128 注释掉,然后:启动:sendmail
2:启动windows 的outlool express 收发邮件,同样可以测试另外一个文件:192.168.11.rev
3:设置local-host-names 文件,用于邮件服务器提供邮件服务的域名:
[iyunv@mail mail]# vi /etc/mail/local-host-names
# local-host-names - include all aliases for your machine here.
sheng.com
同样可以测试一下:把local-host-names 中的内容改变,就发收不到邮件了。
4:编辑sendmail.mc文件
Sendmail服务器的主配置文件是sendmain.cf,该文件配置及其难,不过可以通过配置sendmail.mc然后生成sendmail.cf文件。
vi /etc/mail/sendmail.mc
开启Sendmail服务器的网络接口,Sendmail服务器出于安全考虑,默认只对lo网络接口(IP地址为127.0.0.1)提供服务,为了使服务器能够为主机的所有网络接口(地址为0.0.0.0)提供服务,需要在sendmail.mc文件中进行配置的修改。
...
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
dnl #
...
开启SMTP的用户认证功能。将TRUST_AUTH_MECH(‘EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)前面的dnl以及空格去掉即可。开启之后,邮件服务器要求用户提供用户账户和口令进行身份认证,只有通过身份认证的用户才能通过邮件服务器向外部发送邮件。
...
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
...
5:进入/etc/mail目录,然后使用m4 sendmail.mc > sendmail.cf生成sendmail.cf文件。
cd /etc/mail
m4 sendmail.mc > sendmail.cf
6: 启动sendmail 服务,使senamail.cf 生效:
[iyunv@mail mail]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
7:开启了Sendmail服务器的认证功能之后,需要确保saslauthd服务程序正确运行。
chkconfig --level 35 saslauthd on
[iyunv@mail mail]# service saslauthd restart
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]