Linux下mail服务器应用之sendmail邮件系统的一个案例
sendmail邮件系统的一个案例
实验拓扑
① :在mail.bj.com安装sendmail并进行简单配置
[root@mail ~]# mkdir /mnt/cdrom
[root@mail ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail ~]# cd /mnt/cdrom/Server/
[root@mail Server]# rpm -qa |grep -E "sendmail|m4"
m4-1.4.5-3.el5.1
sendmail-8.13.8-2.el5
[root@mail Server]# rpm -ivh sendmail-
sendmail-8.13.8-2.el5.i386.rpm #主程序包
sendmail-cf-8.13.8-2.el5.i386.rpm #配置工具包
sendmail-devel-8.13.8-2.el5.i386.rpm
sendmail-doc-8.13.8-2.el5.i386.rpm
[root@junjie Server]# rpm -ivh sendmail-cf-8.13.8-2.el5.i386.rpm
[root@mail Server]# cd /etc/mail/
[root@mail mail]# ls
Makefile domaintable.db mailertable.db submit.mc
access helpfile sendmail.cf trusted-users
access.db local-host-names sendmail.mc virtusertable
domaintable mailertable submit.cf virtusertable.db
编辑主要配置文件:
[root@mail mail]# vim sendmail.mc
116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3407/sendmail: acce
[root@mail ~]# service sendmail restart
[root@mail ~]# netstat -tupln |grep sendmail
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4440/sendmail: acce
中继文件:
[root@mail mail]# vim access #增加10,11,12行
9 Connect:127.0.0.1 RELAY
10 Connect:10.106.6 RELAY
11 bj.com OK
12 sh.com RELAY
表明邮件服务器的域名:
[root@mail mail]# vim local-host-names
增加:bj.com
重新启动sendmail服务器:
[root@mail mail]# chkconfig sendmail on
[root@mail mail]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
新建账户:
[root@mail ~]# useradd user1
[root@mail ~]# useradd user2
[root@mail ~]# echo "123" |passwd --stdin user1
[root@mail ~]# echo "123" |passwd --stdin user2