介紹
由於目前阿里企業郵箱,騰訊企業郵箱都有每日發信頻率要求,因此需要自己搭建一個郵件系統完成郵件發送任務.
這篇文章記錄服務器搭建過程遇到的問題與解決方法
實際搭建步驟請查看其它作者的文章
服務器安裝配置
這裏使用的是windows2019操作系統,使用服務器自帶的SMTP服務作爲郵件發送系統
安裝步驟與賬戶配置這裏不做介紹,可以參看其它作者的文章
這裏只說明遇到的問題
554 5.5.2 No valid recipients
發送郵件的時候報錯554 5.5.2 No valid recipients,需要進行以下設置
單擊“訪問”選項卡,點擊“連接”和“中繼”,選中“僅以下列表除外”.
垃圾郵件處理
現象與原因
發送的郵件會被騰訊郵箱識別爲垃圾郵件並直接攔截
原因是沒有添加mx,spf,DMARC記錄
添加相關域名記錄
mx
這個是郵件記錄解析,並且只能解析cname域名,因此還需要添加一個A記錄的普通域名
spf
這個是用於垃圾郵件識別的域名記錄
相關介紹
https://www.renfei.org/blog/introduction-to-spf.html?spm=a2c6h.13066369.0.0.76e0589cbypk7q
檢測地址
http://spf.myisp.ch/
DMARC
相關介紹
https://service.mail.qq.com/cgi-bin/help?subtype=1&&id=16&&no=1001508
最終結果
這裏假設郵箱發送後綴爲 mail.hi.com ,
服務器外網IP爲127.145.27.46
那麼我添加了以下記錄
_dmarc
TXT
v=DMARC1; p=none; sp=none;
10 分鐘
mail
A
127.145.27.46
10 分鐘
mail
TXT
v=spf1 a mx ip4:127.145.27.46 -all
10 分鐘
mail
MX
mail.hi.com | 10
10 分鐘
並且通過http://spf.myisp.ch/檢測得
1.Allow if the IP matches an A or AAAA record of mail.hi.com
127.145.27.46
2.Allow if the IP matches an MX record of mail.hi.com
mail.hizhanhui.com.
127.145.27.46
3.Allow all from the ip 127.145.27.46
4.Deny all IPs which do not match any previous rule
通過測試以後,郵件內容不再被騰訊郵箱攔截,並且163,126也能正常接收郵件
也可以使用這個進行測試
http://www.mail-tester.com/
一些錯誤解決
SMTP Error: The following recipients failed: Temporary lookup failure
運行命令:
postalias hash:/etc/aliases
Recipient address rejected: User unknown in local recipient table
設置
local_recipient_maps =