# 421 4.7.0 服务不可用，关闭传输通道

- **ID:** `communication/smtp-421-service-not-available`
- **领域:** communication
- **类别:** network_error
- **错误码:** `421`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

SMTP服务器因临时资源耗尽（如并发连接过多、速率限制或DNS查找失败）而拒绝连接，如RFC 5321第4.2.5节所定义。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Postfix 3.8.0 | active | — | — |
| Sendmail 8.17.1 | active | — | — |
| Exim 4.96 | active | — | — |
| Microsoft Exchange 2019 | active | — | — |
| Amazon SES SMTP endpoint | active | — | — |

## 解决方案

1. ```
   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.
   ```
2. ```
   Reduce the number of concurrent SMTP connections from your application by adding a connection pool with a max limit (e.g., 10 connections).
   ```
3. ```
   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** — Disabling rate limiting removes protection against spam and DoS attacks; it may cause the server to crash or be blacklisted. (95% 失败率)
- **Increase the SMTP server's max message size** — The 421 error is not about message size but about resource availability; increasing message size can exacerbate the resource issue. (85% 失败率)
- **Use a different SMTP port (e.g., 587 instead of 25)** — Port 587 is for message submission and may have different rate limits, but the underlying resource exhaustion on the server remains unchanged. (70% 失败率)
