解析你的服务器 然后用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 {
-
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
本文地址:http://dufengvip.cn/post-386.html
未标注转载均为本站远程,转载请注明文章出处: