421 4.7.0 服务不可用,关闭传输通道
421 4.7.0 Service not available, closing transmission channel
ID: communication/smtp-421-service-not-available
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Postfix 3.8.0 | active | — | — | — |
| Sendmail 8.17.1 | active | — | — | — |
| Exim 4.96 | active | — | — | — |
| Microsoft Exchange 2019 | active | — | — | — |
| Amazon SES SMTP endpoint | active | — | — | — |
根因分析
SMTP服务器因临时资源耗尽(如并发连接过多、速率限制或DNS查找失败)而拒绝连接,如RFC 5321第4.2.5节所定义。
English
SMTP server rejects connection due to temporary resource exhaustion (e.g., too many concurrent connections, rate limiting, or DNS lookup failures) as defined in RFC 5321 section 4.2.5.
官方文档
https://www.rfc-editor.org/rfc/rfc5321#section-4.2.5解决方案
-
Implement exponential backoff retry in the SMTP client: after receiving 421, wait 30 seconds, then 60, then 120, etc., up to a max of 5 retries.
-
Reduce the number of concurrent SMTP connections from your application by adding a connection pool with a max limit (e.g., 10 connections).
-
Check the SMTP server logs for 'too many connections' and adjust the 'smtpd_client_connection_count_limit' in Postfix (default 50) to a higher value like 100.
无效尝试
常见但无效的做法:
-
Disable rate limiting on the SMTP server entirely
95% 失败
Disabling rate limiting removes protection against spam and DoS attacks; it may cause the server to crash or be blacklisted.
-
Increase the SMTP server's max message size
85% 失败
The 421 error is not about message size but about resource availability; increasing message size can exacerbate the resource issue.
-
Use a different SMTP port (e.g., 587 instead of 25)
70% 失败
Port 587 is for message submission and may have different rate limits, but the underlying resource exhaustion on the server remains unchanged.