騰訊雲 郵箱服務器搭建


123.207.15.141

A 記錄
記錄類型:A
主機記錄:@
記錄值:123.207.15.141
MX 記錄
記錄類型:MX
主機記錄:@
記錄值:yourdomain.com(替換為自己域名)


yum -y install postfix dovecot

 

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'


打開 /etc/postfix/master.cf 文件,將如下兩行前的 # 去除:

smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes

26 smtps inet n - n - - smtpd
27 # -o syslog_name=postfix/smtps
28 -o smtpd_tls_wrappermode=yes

systemctl enable postfix.service
systemctl start postfix.service

cat /var/log/maillog


打開 /etc/dovecot/dovecot.conf 文件,在最下方加入以下配置:
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


打開 /etc/dovecot/conf.d/10-master.conf 文件,找到 service auth 部分,將以下行前面的 # 去除:


unix_listener /var/spool/postfix/private/auth {
mode = 0666
}

96 unix_listener /var/spool/postfix/private/auth {
97 mode = 0666
98 }

systemctl enable dovecot.service
systemctl start dovecot.service

cat /var/log/maillog

useradd test

passwd test
123456

su test

echo "Mail Content" | mail -s "Mail Subject" 245305579@qq.com

客戶端配置
服務器類型:`POP3`
郵箱賬戶: `test@yourdomain.com`

收件(POP3)服務器: `yourdomain.com`
端口: `995`
安全連接(SSL): `是`
用戶名: `test`
密碼: `test用戶密碼`

發件(SMTP)服務器: `yourdomain.com`
端口: `465`
安全連接(SSL): `是`
用戶名: `test`
密碼: `test用戶密碼`

 

域名准備

echo "我是張少龍" | mail -s "我想做運維" 245305579@qq.com

 

dns注意使用223.5.5.5
如果使用8.8.8.8可能因為dns問題無法收到郵件

主機上主機名一定要按要求配置 
deyi.mail.zhangsl.xyz

 

 如果是根域名

mail.zhangsl.xyz

 

 https://cloud.tencent.com/developer/labs/lab/10096

內網時需要自建dns

 

 

后面參考

https://blog.csdn.net/qq_35263061/article/details/60577530


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM