# Postfix queue keeps growing: many deferred messages (postqueue -p, flush, find the reason)

**Code:** `mailq` · **Category:** Email / SMTP · **Seen on:** Postfix, Linux, SMTP

Mail piles up in the deferred queue because deliveries keep failing temporarily.

## Meaning

Read the reason on each deferred message (`postqueue -p`, `postcat -q ID`, mail.log): connection timed out, DNS, blocked port 25, greylisting, remote 4xx. Fix the cause, then `postqueue -f` to retry. Use `postsuper -d ALL deferred` only for spam floods. Limit concurrency and set sensible lifetimes.

## Common causes

- Outbound port 25 blocked
- DNS resolver failing
- Remote server rejecting with 4xx (greylist/rate limit)
- Compromised account flooding the queue
- Disk/IO problems

## Quick fix

1. `postqueue -p | head` and read the deferral reasons
2. Fix DNS/firewall/reputation, then `postqueue -f`
3. Remove spam: `postsuper -d ALL deferred`

## Detailed fix by platform

### Shell

1. 

```bash
postqueue -p | tail -5
mailq | grep -c "^[A-F0-9]"
sudo postqueue -f
```


## How to diagnose

1. **Reason** — Which?
2. **Size** — Growing?
3. **Source** — Spam?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/email/postfix-queue-deferred-growing-flush-mailq)
