桌面版里面默认是安装postfix的
实验环境redhat6.3企业版:
关闭防火墙,关闭selinux,设置本机的ip地址192.168.0.99/25
网关192.168.0.2写可不写,DNS 192.168.0.99
第一步:搭建DNS 域名为wangxing.org
需要安装bind软件,我在安装的同时,把postfix所需的软件的全部安装上
Mutt(测试邮件收发的软件), dovecot 支持pop3 协议 用于收客户端如软件
使用yum安装
[root@localhost ~]# vim /etc/yum.repos.d/a.repo
[a]
name=a
baseurl=file:///media
gpgcheck=0
~ [root@localhost ~]# yum install mutt dovecot bind –y
安装好之后我先去搭建dns,
Vim /etc/named.conf
[root@localhost ~]# cd /var/named/
[root@localhost named]# ls
data dynamic named.ca named.empty named.localhost named.loopback slaves
[root@localhost named]# cp -p named.empty wangxing.org.zone
[root@localhost named]# ls
data named.ca named.localhost slaves
dynamic named.empty named.loopback wangxing.org.zone
[root@localhost named]#
[root@localhost named]# ls
data named.ca named.localhost slaves
dynamic named.empty named.loopback wangxing.org.zone
[root@localhost named]#vim wangxing.org.zone
Service named restart
测试!
[root@localhost named]# nslookup
> mail.wangxing.org
Server: 192.168.0.99
Address: 192.168.0.99#53
Name: mail.wangxing.org
Address: 192.168.0.99
[root@localhost named]# nslookup
> set type=mx
> wangxing.org
Server: 192.168.0.99
Address: 192.168.0.99#53
wangxing.org mail exchanger = 10 mail.wangxing.org.
第二步修改postfix的主配置文件
[root@localhost named]# vim /etc/postfix/main.cf
启用 Service postfix restart
建立aa用户,给aa用户密码123,建立bb用户给bb用户密码123.
建立一个wangxing用户密码也是123,我给admin用户发邮件wangxing能看见
别名设置。
[root@localhost named]# useradd bb
[root@localhost named]# passwd bb
Changing password for user bb.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost named]# useradd wangxing
[root@localhost named]# passwd wangxing
Changing password for user wangxing.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost named]#
设置wangxing的别名为admin
[root@localhost named]# vim /etc/aliases
[root@localhost named]# newaliases 生成你的别名设置
下面使用mutt 测试一下(在命令行下测试):
使用m是建立邮件
Y是发送邮件,r是回复邮件, 在命令行下使用用户登录,输入mutt测试邮件的
发送,退出q!
给bb发送邮件!
回复aa的邮件
bb回复给aa的邮件
Bb回复给aa的邮件
给admin用户发邮件wangxing能看见
使用wangxing用户登录 能看到发给admin的用户邮件
第三步配置dovecot
[root@localhost named]# cd /etc/dovecot
[root@localhost dovecot]# ls
conf.d dovecot.conf
[root@localhost dovecot]#vim dovecot.conf
[root@localhost dovecot]# cd conf.d/
[root@localhost conf.d]# ls
10-auth.conf 20-lmtp.conf auth-master.conf.ext
10-director.conf 20-pop3.conf auth-passwdfile.conf.ext
10-logging.conf 90-acl.conf auth-sql.conf.ext
10-mail.conf 90-plugin.conf auth-static.conf.ext
10-master.conf 90-quota.conf auth-system.conf.ext
10-ssl.conf auth-checkpassword.conf.ext auth-vpopmail.conf.ext
15-lda.conf auth-deny.conf.ext
20-imap.conf auth-ldap.conf.ext
[root@localhost conf.d]#
[root@localhost conf.d]# vim 10-auth.conf
[root@localhost conf.d]# vim 10-mail.conf
[root@localhost conf.d]# service postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@localhost conf.d]#
在xp上可以测试一下客户端的dns指向我dns服务器;
在xp上解析到我的服务器为mail.wangxing.org
打开ouklook输入我的用户名和服务器
然后收发邮件试试
用aa给bb发邮件
点击接收我就收到aa给bb发的邮件
给aa回复邮件
在命令行下测试收发邮件
安装 telnet 软件
查看我发的邮件!
查看邮件使用的pop3 协议,端口号 110