搭建邮件系统,采用sendmail+dovecot+openwebmail架构
1.添加DNS MX 记录和mail.test.com
2.安装sendmail
    a) rpm -ivh sendmail
    b) rpm -ivh sendmail-cf
    c) rpm -ivh m4
3.修改/etc/mail/sendmail.mc
去掉116行注释,修改为DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
修改156行,为LOCAL_DOMAIN(`test.com')dnl

添加smtp认证需要:
    去掉52、53行注释,为

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

    去掉123行注释,为DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl

4.生成 sendmail.cf 主配置文件
cd /etc/mail && m4 sendmail.mc > sendmail.cf
5.安装dovecot包,让mail支持使用MUA接收邮件
yum install dovecot
6.修改/etc/dovecot.conf
去掉注释,为protocols = imap imaps pop3 pop3s
7.启动sendmail和dovecot服务
Service sendmail start
Service dovecot start
8.群发邮件
/etc/aliases加入
tech:test1,test2
让新添加的组生效
#newaliases

9.转发控制
vim /etc/mail/access
10.安装openwebmail
所需要的包:cyrus-sasl、perl-Text-Iconv、perl-suidperl、perl-Compress-Zlib、perl- CGI-SpeedyCGI
    a)rpm –ivh cyrus-sasl、perl-Text-Iconv、perl-suidperl、perl-Compress-Zlib、perl- CGI-SpeedyCGI
    b)rpm –ivh openwebmail-2.40-1.i386.rpm
    c)cd /var/www/cgi-bin/openwebmail
    d)./openwebmail-tool –init
    e)cd etc
    f)vim dbm.conf
    g)         找到并修改底下几行:
    dbm_ext               .db
    dbmopen_ext               .db
    dbmopen_haslock         yes
    h)/var/www/cgi-bin/openwebmail/openwebmail-tool.pl –init


Welcome to the Open WebMail!
 
This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:
 
OS: Linux 2.4.22-1.2199.nptl i686
Perl: 5.008003
WebMail: Open WebMail 2.40 20040816
 
Send the site report?(Y/n)
sending report...
 
Thank you.
 
    i)进一步设定
    Vim /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
    default_language                zh_CN.GB2312
    添加:enable_webdisk            no 禁用网络磁盘

11.启动http服务。
访问http://mail.test.com/cgi-bin/openwebmail/openwebmail.pl
由于访问域名过长,需添加跳转
在/var/www/html/添加index.html,内容为:
<html>
<metahttp-equiv="refresh"Content="0;url=http://mail.test.com/cgi-bin/openwebmail/openwebmail.pl">
</html>
12.配置完成,访问http://mail.test.com