搭建自己的邮件服务器(postfix devocot cyrus-sasl) centos7 系统下配置
2018-01-05 16:23
627 查看
网上用了很多家企业邮箱免费的不好用,或者收费的价格太贵…那干脆自己搭建邮件服务器了.
搭建邮件服务器目前最流行的应该是 postfix + devocot 组件. 而系统自带的 sendmail 配置起来相当困难,所以我压根就没有去试.并且在安装前直接卸载了 sendmail .
第一步
设置域名MX 解析首先要有指定 ip 的 A 记录解析 @ A 111.111.111.111
需要有 mail 二级域名的 A 记录解析 mail A 111.111.111.111
MX 记录解析 @ MX mail.yijiebuyi.cn.
TXT解析 @ TXT v=spf1 include:spf.mail.yijiebuyi.com ~all
第二步
//停止 sendmail 服务 /etc/init.d/sendmail stop //卸载 sendmail 服务 yum remove sendmail
第三步
安装 postfix 和 dovecotyum install postfix dovecot
第四步
安装 cycus-saslyum install cyrus-sasl-*
第五步
配置 postfixvim /etc/postfix/main.cf
myhostname=mail.yijiebuy.com //这里要换成你自己的邮箱服务器 mydomain=yijiebuyi.com //这里换成你自己的主机服务器 myorigin = $mydomain inet_interfaces = all #可以接收所有域名的邮件 inet_protocols = ipv4 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,mail.$mydomain, www.$mydomain, ftp.$mydomain local_recipient_maps = mynetworks =0.0.0.0/0 #设置内网ip 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
第六步
配置 dovecotvim /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
第七步
配置 sasl2vim /etc/sysconfig/saslauthd
MECH=shadow #指定以本地系统用户名认证
vim /usr/lib64/sas12/smtpd.conf //64位系统 vim /usr/lib/sas12/smtpd.conf //32位系统
pwcheck_method: saslauthd mech_list: PLAIN LOGIN log_level:3
第八步
启动服务启动 postfix ,dovecot ,saslauthd 服务
service postfix start service dovecot start service saslauthd start
注意: centOS 7下将不再使用 service 来启动服务,而是跳转到 systemctl 指令下.
下面我们使用 systemctl 来启动上面的3个服务
systemctl start dovecot systemctl start postfix systemctl start saslauthd
如何查看 saslauthd 命令是否启动服务成功,使用 status 来查看.
systemctl status postfix ● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2016-05-23 18:29:21 CST; 20h ago
上面的提示信息告诉 postfix 服务正在运行中.
第九步
创建新账号添加账户 admin
[root@10-10-126-106 ~]# useradd admin
为帐号 admin 创建密码
[root@10-10-126-106 ~]# passwd test Changing password for user test. New password: Retype new password: passwd: all authentication tokens updated successfully.
第十步
配置客户端我本地mail客户端是 mac 下的 foxmail ,选择添加账户 admin
上面的 pop3 和 smtp 服务器为第一步中配置的MX解析记录: mail.yijiebuyi.com
然后重复 第九步 和第十步 添加测试帐号 soso@yijiebuyi.com
第十一步
发送邮件目前我的 foxmail 客户端添加了如下邮箱帐号
其中 admin 和 soso 是 mail.yijiebuyi.com 邮箱服务器下配置的测试帐号.
尝试用 soso@yijiebuyi.com 发送邮件给 admin@yijiebuyi.com admin帐号收件箱:
soso帐号发件箱:
相关文章推荐
- CentOS6.5上简易搭建Postfix、Dovecot、Sasl、OPenwebmail局域网邮件服务器以及DNS服务器
- CentOS 搭建postfix邮件服务器 配置php mail
- Centos7下postfix+Dovecot+cyrus-sasl搭建个人局域网邮件服务器(测试使用)
- Linux系统,Centos7版本下搭建postfix服务器及其相关配置应用
- CentOS7.4中Postfix邮件服务器的搭建(一)-----环境配置及简单搭建
- Postfix邮件服务器搭建之虚拟用户配置
- Hadoop2.X/YARN环境搭建--CentOS7.0系统配置
- CentOS 5下搭建使用MySQL认证用户的POSTFIX邮件服务器
- 搭建邮件服务器 Postfix + Dovecot (CentOS)
- RedHat el5.0 搭建 Postfix 邮件服务器系统<一>
- Centos5.5搭建postfix邮件服务器:Postfix+extmail
- RedHat el5.0 搭建 Postfix 邮件服务器系统
- 邮件系统服务器搭建记录(二)(Postfix+Cyrus-sasl+Courier-authlib+Dovecot+ExtMail+MySQL)
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
- 测试环境搭建之CentOS 7.0系统安装配置步骤详解
- CentOS5.5下postfix邮件系统安装配置
- Centos6 Postfix+Dovecot+Postfixadmin+Roundcube 搭建Webmail邮件系统
- Centos7搭建邮件服务器-Postfix+Cyrus-sasl+Courier-authlib+Dovecot+ExtMail+Centos7
- linux下邮件服务器系统postfix安装与配置