一、停止sendmail服务(注:sendmail与postfix不能同时启用,需将系统中的sendmail服务停止或卸载,建议工作中将其卸载)

[root@mail ~]# service sendmail stop    //停止sendmail服务

image

[root@mail ~]# chkconfig sendmail off  //设为开机关闭

[root@mail ~]# netstat -tupln |less  //查看端口,25端口已关闭

image

二、安装postfix

mount /dev/cdrom /mnt/cdrom/ //挂载光盘

cd /mnt/cdrom/Server/

[root@mail Server]# ll post* //查看postfix软件包

image

[root@mail Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm  //安装postfix

image

 

[root@mail Server]# service postfix start  //启动postfix服务
Starting postfix:                                          [  OK  ]
[root@mail Server]# chkconfig postfix on  //设为开机时启动
[root@mail Server]# netstat -tupln |grep 25   //查看25端口状态

tcp        0      0 127.0.0.1:25                0.0.0.0:*                  LISTEN      3791/master      //master是所有模块的管辖者  
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      3254/0             
tcp        0      0 ::1:6010                    :::*                        LISTEN      3254/0

三、本地用户之间发送邮件

[root@mail Server]# telnet 127.0.0.1 25  //telnet到25端口

  image

[root@mail Server]# su - user 3 //切换到user3

[user3@mail ~]$ mail  //查看邮件

image

四、中继的实现

[root@mail ~]# vim /etc/postfix/main.cf  //编辑配置文件,创建认证

image

image

image

image

image  //禁用此项

image  //禁用此项

image

image

[root@mail ~]# postfix check  //测试语法

[root@mail ~]# service postfix restart   //重启服务

image

1、本地邮件发送

[root@mail ~]# telnet 127.0.0.1 25  

image

[root@mail ~]# su – user3   //切换到user3
[user3@mail ~]$ mail   //查看邮件

image

 

[root@mail ~]# telnet 127.0.0.1 25

image

2、外部用户给本地主机用户发送邮件

image

[root@mail ~]# vim /etc/postfix/main.cf //修改配置文件

image   //允许192.168.101.0网段的用户被中继

[root@mail ~]# service postfix restart  //重启服务

image

image

五、认证的实现

1、与本地用户区域不相同的用户的认证

[root@mail ~]# vim /etc/postfix/main.cf  //修改配置文件

image

[root@mail ~]# service saslauthd restart  //重启此服务

image

[root@mail ~]# echo -n "user2@163.com" |openssl base64  //获取用户验证信息
dXNlcjJAMTYzLmNvbQ==
[root@mail ~]# echo -n "123" |openssl base64   //获取密码验证信息
MTIz

image

2、与本地用户区域相同的用户的认证

image

[root@mail ~]# su - user2
[user2@mail ~]$ mail

image

[root@mail ~]# vim /etc/postfix/main.cf

image  //只允许通过认证的用户接收邮件

[root@mail ~]# service postfix restart  //重启服务

image

 

image

[root@mail ~]# su – user2

image