大横幅1
大横幅2
到期时间:永久 到期时间:推广
小横幅3 小横幅4
  1. 当前位置:网站首页 > 技术教程

基于Linux搭建邮箱服务


解析你的服务器 然后用MX记录解析你的域名

一、解析生效检查

nslookup -q=mx XXXXXX.com
ping XXXXXX.com

二、Postfix、Dovecot 安装

$$yum -y install postfix dovecot

三、配置 Postfix

postconf -e 'myhostname = server.yourdomain.com'
postconf -e 'mydestination = localhost, localhost.localdomain'
postconf -e 'myorigin = $mydomain'
postconf -e 'mynetworks = 127.0.0.0/8'
postconf -e 'inet_interfaces = all'
postconf -e 'inet_protocols = all'
postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain'
postconf -e 'home_mailbox = Maildir/'
postconf -e 'smtpd_sasl_type = dovecot'
postconf -e 'smtpd_sasl_path = private/auth'
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_sasl_authenticated_header = yes'
postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem'
postconf -e 'smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem'

注意:记得将 yourdomain.com 替换为你自己的域名

配置 smtps

部分邮件客户端依赖于使用 465 端口提供加密连接,所以我们修改配置,允许 Postfix 使用 465 端口发送邮件。
smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes
(注意: -o 前要保留空格)

启动 Smtp服务

$$systemctl enable postfix.service
systemctl start postfix.service

配置 Dovecot

ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem

protocols = imap pop3 lmtp
listen = *
mail_location = Maildir:~/Maildir
disable_plaintext_auth = no

修改 10-master.conf

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


  1. mode = 0666

}

启动 Dovecot

$$systemctl enable dovecot.service
systemctl start dovecot.service

添加用户

useradd test

修改密码

passwd test

切换用户

su test

发信测试

echo "Mail Content" | mail -s "Mail Subject" xxxx@xxx.com


本文最后更新于2020-9-24,已超过 3个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
获取更多资讯请加入交流群

    协助本站SEO优化一下,谢谢!
    关键词不能为空
版权说明

本文地址:http://kirinbk.cn/post-386.html
免责声明:本站文章仅用于科普及教育用途,远离犯罪!

发表评论

联系我们

在线咨询:点击这里给我发消息

QQ交流群:KirinBlog

工作日:8:00-23:00,节假日休息

扫码关注