作者:dbtan |【转载时请以超链接形式标明文章出处作者信息】


安装包:(3个)

[root@vm5: ~/tqwjj]#rpm -qa | grep sendmail

sendmail-cf-8.13.8-2.el5

sendmail-8.13.8-2.el5

[root@vm5: ~/tqwjj]#rpm -qa | grep dovecot

dovecot-1.0-1.2.rc15.el5

邮件服务器必须靠DNS解析!

MTA:邮件传输代理。

MUA:邮件客户代理。

MDA:邮件投递。

配置sendmail邮件服务器步骤:(基本的9步)

配置DNS服务器!

见配置DNS服务器总结。

配置MAIL服务器(sendmail

sendmail主控配置文件:/etc/mail/sendmail.mc

通过.mc文件来配置.mf

.mf文件是用m4宏语言编写的(以dnl # 注释)

[root@vm5: /etc/mail]#vim sendmail.mc

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')

全网段监听

[root@vm5: /etc/mail]#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

[root@vm5: /etc/mail]#service sendmail restart

设置local-host-names

[root@vm5: /etc/mail]#vim local-host-names

# local-host-names - include all aliases for your machine here.

vm5.com.

启动dovecot服务,用于开启imap143端口,pop3110端口。

RHEL4中,要修改/etc/dovecot.conf配置文件:

[root@vm5: /etc/mail]#vim /etc/dovecot.conf

protocols = imap imaps pop3 pop3s

[root@vm5: /etc/mail]#service dovecot restart

RHEL5中,直接启动dovecot服务就开启了143、110端口。

[root@vm5: /etc/mail]#service dovecot restart

webmail通过浏览器收发邮件。

安装包:(1个)

[root@vm5: /etc/mail]#rpm -qa | grep ^squirrelmail

squirrelmail-1.4.8-4.el5

先配置/etc/hosts文件,

[root@vm5: /etc/mail]#vim /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

::1 localhost6.localdomain6 localhost6

10.0.4.5 vm5.com vm5

执行/usr/share/squirrelmail/config/目录下的conf.pl配置脚本

打开浏览器,在地址栏输入http://10.0.4.5/webmail 即可登陆mail服务器。

转发控制 access

[root@vm5: /etc/mail]#vim access

# Check the /usr/share/doc/sendmail/README.cf file for a description

# of the format of this file. (search for access_db in that file)

# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc

# package.

#

# by default we allow relaying from localhost...

Connect:localhost.localdomain RELAY

Connect:localhost RELAY

Connect:127.0.0.1 RELAY

注:RELAY(默认):(无条件)允许转发。

OK:只接收,不转发(不中继)。

DENY:拒绝(用于简单的反垃圾邮件)

DISCARD:丢弃,不响应(也没有提示信息)。

aliases别名

[root@vm5: /etc/mail]#vim /etc/aliases

stuff: tq;slash

别名:给stuff@vm5.com发要件,相当于给tq和slash同时发相同的邮件。

认证:

[root@vm5: /etc/mail]#vim sendmail.mc

① TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')

② define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')

添加上面两句,即可添加认证。

邮件虚拟机:

DNS配置文件加zonecat.org

DNS数据文件加cat.org.db

local-host-namescat.org

[root@vm5: /etc/mail]#vim local-host-names

# local-host-names - include all aliases for your machine here.

vm5.com.

cat.org.

设置virtusertable虚拟服务器表

[root@vm5: /etc/mail]#vim virtusertable

tq@cat.org tq1

说明:在一台MAIL服务器上设置了多个MTA时,可能就会有tq@vm5.com和tq@cat.org两个域名下有相同的用户名。为了避免冲突,把tq@cat.org的tq帐户映射为tq1(此时,要先创建好tq1用户),即:把tq帐户映射帐户为tq1。

- The End -