CentOS6.3系统使用sendmail/dovecot搭建邮件服务器
1.MX解析不说了。
2.安装配置dovecot也不多说了。
3.安装配置sendmail软件 yum install -y sendmail sendmail-cf m4
切换系统MTA服务
[root@localhost postfix]# service postfix stop
关闭 postfix:
[确定]
[root@localhost postfix]# alternatives --config mta
共有 2 个程序提供“mta”。
选择 命令
-----------------------------------------------
+ 1
/usr/sbin/sendmail.postfix
* 2
/usr/sbin/sendmail.sendmail
按 Enter 来保存当前选择[+],或键入选择号码:2
[root@localhost postfix]#
配置sendmail-----1
[root@localhost mail]# cat sendmail.mc |grep -v '^dnl '|awk -F:
'{ print $1 }'
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS',
`authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
(大约在53行,去掉注释)
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5
CRAM-MD5 LOGIN PLAIN')dnl (去掉注释)
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o
/etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o
/etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o
/etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
原为 Addr=127.0.0.1 修改为 :Addr=0.0.0.0
FEATURE(`accept_unresolvable_domains')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
[root@localhost mail]#
配置sendmail----2
[root@localhost mail]# cat access |grep -v ^#
Connect:localhost.localdomain
RELAY
Connect:localhost
RELAY
Connect:127.0.0.1
RELAY
Connect:abc.com
RELAY
//#添加转发中继或许允许那些源可以使用该邮局服务器
[root@localhost mail]#
配置sendmail----3(将mc文件转换为cf格式和生成access.db的数据库文件)
[root@localhost mail]# m4 sendmail.mc>sendmail.cf
/*将mc文件转换为cf
[root@localhost mail]# makemap hash access.db < access
/*将access生成access.db的数据库文件
[root@localhost mail]# service sendmail start
正在启动 sendmail:
[确定]
启动 sm-client:
[确定]
[root@localhost mail]#
创建用户进行测试。这里上面创建了test0 和test1用户了。不再新建用户了。使用不同的邮件客户端(thunderbird)进行测试