redhat6+postfix+devocot+cycus-sasl搭建邮箱服务器

一、搭建邮箱服务器之前,先了解下各组件功能

  • postfix邮件服务器,实现smtp协议

  • devocot: 实现IMAP和POP3协议

  • cycus-sasl: 实现了smtp协议的postfix, 不具备身份验证能力,虽然信封上的发件人地址表明了身份,然而,
  • 由于信封地址实在太容易假造,所以不能当成身份凭据。sasl服务作为smtp协议的补充,能够验证客户身份。

 

二、邮件服务器搭建

    第1步 :   配置DNS

         首先准备一个域名,以51-cto.cn为例子,配置DNS记录:

         主机      记录类型                         记录值 

          @             TXT                      v=spf1 ip4:123.xx.xx.xxx   

          @              MX                       mail.51-cto.cn     
          mail            A                         123.xx.xx.xxx

    第2步:   安装postfix 、dovecot

           yum install postfix  dovecot

    第3步:   安装cyrus-sasl

        yum -y install cyrus-sasl-*

    第4步:   配置postfix 

           vim /etc/postfix/main.cf  修改配置项

           myhostname=mail.51-cto.cn#邮件服务器主机名称

           mydomain=51-cto.cn
           myorigin = $mydomain
           inet_interfaces = all   
           inet_protocols = ipv4

           #mydestination 

           mydestination = $myhostname, localhost.$mydomain, localhost,

           $mydomain,mail.$mydomain, www.$mydomain, ftp.$mydomain   #接收邮件收件人的域名

           mynetworks =0.0.0.0/0
           relay_domains = $mydestination
           home_mailbox = Maildir/

            smtpd_sasl_auth_enable = yes
           smtpd_sasl_security_options = noanonymous
           broken_sasl_auth_clients = yes
           smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks
           smtpd_client_restrictions = permit_sasl_authenticated

第5步 配置devocot 

          vim /etc/dovecot/dovecot.conf  修改配置项

          protocols = imap pop3 lmtp

          listen = *


          vim /etc/dovecot/conf.d/10-auth.conf

          disable_plaintext_auth = no

          auth_mechanisms = plain


         vim /etc/dovecot/conf.d/10-mail.conf

         mail_location = maildir:~/Maildir


        vim /etc/dovecot/conf.d/10-ssl.conf

         ssl = no

第6步: 配置cycus-sasl

        vim /etc/sysconfig/saslauthd

        MECH=shadow


         vim /usr/lib64/sasl2/smtpd.conf

         pwcheck_method: saslauthd

         mech_list: PLAIN

         LOGIN log_level:3

第7步:启动服务

      service  postfix start

      service dovecot start

      service saslauthd start

第8步 新建邮箱账号

    useradd test2
     passwd test2

 

第8步 配置foxmail客户端

 

   

   

 

云邮件服务提供商:https://web.sendcloud.net