最近把发验证邮件的邮箱服务器换成了Docker(tvial/docker-mailserver),但是通过运行在Docker的Calibre-Web(linuxserver/calibre-web)发送验证邮件老是不成功。上去Docker查看了mailserver的log,显示如下错误信息:
smtp postfix/submission/smtpd[17987]: NOQUEUE: reject: RCPT from unknown[183.33.241.13]: 501 5.5.2 <600>: Helo command rejected: Invalid name
然后去谷歌了一下,找到了篇类似问题的QA,
It seems that you restrict EHLO for your authenticated users. Change:
smtpd_helo_restrictions = permit_mynetworks,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit
to:
smtpd_helo_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit
然后通过docker-mailserver的帮助,怎么覆盖posfix的默认配置
https://github.com/tomav/docker-mailserver/wiki/Override-Default-Postfix-Configuration
在docke-compose的目录里面切换到config,创建一个postfix-main.cf配置文件,把上面的smtpd_helo内容填进去。
root@smtp:/sharedfolders/docker/mailserver/config# ls
opendkim postfix-accounts.cf postfix-aliases.cf postfix-main.cf postfix-virtual.cf ssl
root@smtp:/sharedfolders/docker/mailserver/config# cat postfix-main.cf
#fix "Helo command rejected: Invalid name"
smtpd_helo_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit
然后运行docker-compose关闭再开启docker-mailserver应用配置.
root@smtp:/sharedfolders/docker/mailserver# docker-compose down
Stopping mail ... done
Removing mail ... done
Removing network mailserver_default
root@smtp:/sharedfolders/docker/mailserver# docker-compose up -d mail
Creating network "mailserver_default" with the default driver
Creating mail
然后再在Calibre-Web点发送验证邮件就成功了。