我在 Parabola(基于 Arch)安装中设置了 Postfix + Dovecot。它看起来可以正常工作,我可以向任何地址发送电子邮件,它也可以正常工作,还可以接收邮件但仅限于本地地址。
如果我这样做,我会收到电子邮件(就像自动向我发送电子邮件一样)。但如果我从另一个电子邮件帐户(外部帐户)这样做,我根本收不到它。mail [email protected]
所有端口均可在本地工作,但如果我尝试telnet [my_public_IP] 25
(或 587)则会失败(我会询问我的 ISP 发生了什么)。
更多输出:
$ postconf -n
alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/bin
compatibility_level = 2
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = localhost # I've tried using my IP address, with no luck
inet_protocols = all
mail_owner = postfix
mailbox_size_limit = 134217728
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 134217728
meta_directory = /etc/postfix
mydomain = eumela.ga
myhostname = smtp.eumela.ga
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/letsencrypt/live/eumela.ga/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/eumela.ga/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
unknown_local_recipient_reject_code = 550
virtual_alias_domains = $mydomain
virtual_alias_maps = hash:/etc/postfix/virtual
$ cat /etc/dovecot/dovecot.conf
protocols = imap pop3
auth_mechanisms = plain
passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
user = root
}
#service auth {
# inet_listener {
# port = 587
# }
#}
mail_home = /home/vmail/%d/%n
mail_location = maildir:~
ssl_cert = </etc/letsencrypt/live/eumela.ga/fullchain.pem
ssl_key = </etc/letsencrypt/live/eumela.ga/privkey.pem
输出10-auth.conf、10-mail.conf、10-master.conf、10-ssl.conf 和 20-imap.conf(来自 /etc/dovecot/conf.d)
更新:这里这是今天(8 月 24 日)的日志。它是 mail.log、mail.err 和 mail.info 的组合
答案1
inet_interfaces = localhost # I've tried using my IP address, with no luck`
如果你只在本地主机上监听,你的 smtp 服务器将无法从外部访问。你应该把它改成全部.参见 http://www.postfix.org/postconf.5.html#inet_interfaces
重新启动 postfix 服务后,您可以检查netstat -tulpn
服务器正在监听的接口和端口。
如果 postfix 正在监听端口 25 上的所有接口,但仍然无法从外部访问,则您应该检查防火墙设置
答案2
感谢@Stefan 的回答,但我还必须这样做:
$ sudo postconf -e 'mydestination = localhost.$mydomain, localhost, $mydomain'
现在我可以接收来自外面的邮件了......
PS:我可以在‘mydestination’中指定‘all’吗?
答案3
我的所有域名都出现了类似的问题,没有一个域名可以接收来自外部邮件客户端(如 Outlook 等)的电子邮件。但后来我将端口 25 添加到防火墙,从那时起,我就开始接收电子邮件。
执行以下检查:
netstat -tulpn
“如果你看到端口 25 意味着你正在监听这个端口本地“- 然后,检查你的防火墙,你可能不允许流量到这个端口
- 将端口 25 添加到防火墙
- 最后,检查你的邮件日志
tail -f /var/log/maillog
我希望这可以帮助别人。
答案4
就我的情况而言(Virtualmin,CentOS 7,mail_version = 2.10.1),出于某种原因,我的 postfix main.cf
inet_interfaces = loopback-only
我把它改成了
inet_interfaces = all
太棒了!立即开始收到邮件...