Centos6.5搭建邮件服务器(Postfix+Dovecot )

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos6.5搭建邮件服务器(Postfix+Dovecot )相关的知识,希望对你有一定的参考价值。

参考博文:

http://blog.jjonline.cn/linux/185.html

http://blog.51cto.com/11038104/1916669



第一步、关闭iptables、selinux

        /etc/init.d/iptables stop

        chkconfig --level 3 iptables off

        vim /etc/selinux/config

                SELINUX=disable


第二步、安装Postfix、Dovecot

        #centos6.5本身就带postfix所以不用安装

        yum install dovecot telnet vim -y


第三步、配置postfix

        vim /etc/postfix/main.cf

                # 约75行: 取消注释,设置

                myhostname = mail.netdj.net

                # 83行: 取消注释,设置域名

                mydomain = netdj.net

                # 99行: 取消注释

                myorigin = $mydomain

                # 116行: 修改

                inet_interfaces = all

                #119行: 推荐ipv4,如果支持ipv6,则可以为all

                inet_protocols = ipv4

                #164行: 指定可接收邮件的主机名或域名

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

                #264行: 取消注释,指定内网和本地的IP地址范围(可以作为client)

                mynetworks = 10.0.0.0/8, 127.0.0.0/8, 192.168.0.0/16

                #419行: 取消注释,邮件保存目录

                home_mailbox = Maildir/

                #571行: 指定MUA通过smtp连接postfix时返回的header头信息

                smtpd_banner = $myhostname ESMTP


                # 添加到最后

                #规定邮件单封最大尺寸为10M(单位是Byte)

                message_size_limit = 5242880

                # 规定收件箱最大容量为20M(单位是Byte)

                mailbox_size_limit = 20971520

                # SMTP认证

                smtpd_sasl_type = dovecot

                smtpd_sasl_path = private/auth

                smtpd_sasl_auth_enable = yes

                smtpd_sasl_security_options = noanonymous

                smtpd_sasl_local_domain = $myhostname

                smtpd_recipient_restrictions=permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject


第四步、配置Dovecot

        vim /etc/dovecot/dovecot.conf

                # 26行: 如果不使用IPv6,请修改为*

                listen = *

        

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

                # 9行: 取消注释并修改

                disable_plaintext_auth = no

                # 97行: 使用简单登录

                auth_mechanisms = plain login

        

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

                # 30行:指定位置

                mail_location = maildir:~/Maildir

        

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

                # 88-90行: 取消注释并添加

                # Postfix smtp验证

                    unix_listener /var/spool/postfix/private/auth {

                       mode = 0666 

                       user = postfix 

                       group = postfix

                    }

        

        /etc/init.d/postfix start

        /etc/init.d/dovecot start

        /etc/init.d/postfix restart

        /etc/init.d/dovecot restart

        chkconfig dovecot on

        chkconfig postfix on


第五步、创建用户

        useradd mail1 ; echo "123456" | passwd --stdin mail1

        useradd mail2 ; echo "123456" | passwd --stdin mail2


以上是关于Centos6.5搭建邮件服务器(Postfix+Dovecot )的主要内容,如果未能解决你的问题,请参考以下文章

postfix邮件服务器搭建-安装篇

postfix-企业邮件服务器搭建完整版

Postfix+Dovecot+MySQL搭建邮件服务器

Centos6.5 安装iRedMai

烂泥:Postfix邮件服务器搭建之准备工作

linux搭建postfix邮件服务