排查 Debian 邮件故障,一般按 “能发 → 能收 → 能中继 → 能认证 → 日志” 的思路来。下面给你一套通用排查流程,适用于 Postfix / Exim / Dovecot 等常见组合。
systemctl status postfix
systemctl status dovecot
如果没启动:
systemctl start postfix
systemctl start dovecot
ss -lntp | grep -E '25|465|587|110|143|993|995'
常见端口:
如果端口没监听,说明服务没起或配置错误。
Debian 默认日志位置:
journalctl -u postfix -f
journalctl -u dovecot -f
或传统日志:
tail -f /var/log/mail.log
tail -f /var/log/mail.err
重点看:
status=bouncedrelay=noneconnection refusedauthentication failedUser unknownapt install mailutils
echo "test" | mail -s "test mail" user@domain.com
postqueue -p
或
mailq
卡在队列里说明 发不出去。
telnet localhost 25
示例:
HELO test.com
MAIL FROM:<user@domain.com>
RCPT TO:<user@domain.com>
DATA
Hello
.
QUIT
正常应看到:
250 OK
dig domain.com MX
必须存在 MX 记录,例如:
domain.com. 300 IN MX 10 mail.domain.com.
还要检查:
dig mail.domain.com A
日志常见:
554 5.7.1 Rejected blocked by spam filterRelay access denied检查:
doveadm log errors
tail -f /var/log/mail.log
检查:
df -h
swaks --to user@domain.com \
--from user@domain.com \
--server mail.domain.com \
--port 587 \
--auth \
--tls
若认证失败,检查:
postconf | grep sasl
以及 Dovecot SASL 是否启用。
iptables -L -n
ufw status
放行邮件端口:
ufw allow 25
ufw allow 587
ufw allow 993
✅ 直接帮你分析 log ✅ 判断是 Postfix 还是 Dovecot 的问题 ✅ 按你是“发不出去 / 收不到 / 退信”来精确排查
你可以把:
/var/log/mail.log 相关片段postconf -ndovecot -n贴出来,我可以直接帮你定位 ✅