配置dns

主配置文件
options {
         directory "/var/named";
};
 zone  "djy.com"{
        type  master;
        file  "djy.com.zone";
        allow-transfer {198.168.18.3;};
} ;
区域配置文件
$TTL    86400
@               IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
djy.com.         IN NS          mail.djy.com.
mail             IN A           192.168.18.2
mail             IN MX 10       mail.djy.com
 
~                                                 
停用sendmail 服务
service sendmail stop
安装postfix软件包
配置主配置文件
/etc/postfix/main.cf
myhostname = mail.djy.com
mydomain = djy.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname,$mydomain
mynetworks = 192.168.18.0/24, 127.0.0.0/8
 
 
SMTP认证
安装 cyrus-sasl 软件包
配置 vim /etc/sysconfig/saslauthd
MECH=shadow
 
 /etc/init.d/saslauthd start
建立用户和密码
testsaslauthd -u jjj -p 'jjj'
perl -MMIME::Base64 -e 'print encode_base64("jjj")'
 telnet mail.djy.com 25
 
service postfix restart
Trying 192.168.18.2...
Connected to mail.djy.com (192.168.18.2).
Escape character is '^]'.
220 mail.djy.com ESMTP Postfix
ehlo djy.com
250-mail.djy.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH NTLM PLAIN DIGEST-MD5 CRAM-MD5 LOGIN GSSAPI
250-AUTH=NTLM PLAIN DIGEST-MD5 CRAM-MD5 LOGIN GSSAPI
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
ampq
334 UGFzc3dvcmQ6
ampq
235 2.0.0 Authentication successful
 
chkconfig postfix on
 
关联smtp验证与邮件服务器
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =' '
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
安装dovecot
配置 /etc/dovecot.conf
 protocols = pop3 pop3s
 
 
protocol pop3 {
     listen = *:10100
 #    ..
}
 执行一下命令
/etc/init.d/dovecot restart
chkconfig dovecot on
安装cyrus-imapd cyrus-imapd-devel -y
进入postfix主配置文件 将第456行的注释去掉
执行 /etc/init.d/cyrus-imapd restart
  chkconfig cyrus-imapd on
手动件cyrus的密码
service postfix restart
连接后台
cyradm -u cyrus localhost
为用户建立邮箱
localhost.localdomain> cm user.jjj.Send
localhost.localdomain> cm user.jjj.Trash
localhost.localdomain> cm user.jjj.Drafts
localhost.localdomain> quit
安装(实现wed)
yum install squirrelmail -y
进入配置界面
 /usr/share/squirrelmail/config/conf.pl 
 
 
配置完之后
测试收发邮件