Back to tutorials
Tutorial

VPS Email Queue Troubleshooting Tutorial (2026): Find Stuck Mail, Fix Deferrals, and Restore Deliverability Fast

VPS email queue troubleshooting tutorial for Postfix/Exim: find stuck mail, fix deferrals, stop bounces, and restore delivery fast.

By Anurag Singh
Updated on Oct 03, 2026
Category: Tutorial
Share article
VPS Email Queue Troubleshooting Tutorial (2026): Find Stuck Mail, Fix Deferrals, and Restore Deliverability Fast

A mail queue that keeps growing can wreck your sending reputation fast. Invoices arrive late. Password resets show up hours after they’re needed. Customers say they never received an order confirmation. This VPS email queue troubleshooting tutorial gives you a repeatable workflow to see what’s stuck, learn why, and fix it without hurting deliverability.

This guide assumes you run mail on a Linux VPS or dedicated server with Postfix (common on Ubuntu/Debian) or Exim (common on cPanel/WHM).

If you host mail for clients as a reseller, the same steps apply. In that case, enforce tighter rate limits and require strict authentication.

Before you touch the queue: safety checks that prevent a bad day

First, confirm you’re not dealing with a compromised site sending spam. If you flush a huge queue blindly, you can push thousands of messages at once. That can get your IP or domain blocked.

  • Snapshot first: If this is a VPS, take a rollback point before broad changes. If you already use LVM or Btrfs snapshots, stick to your normal process. (Need a checklist? See this VPS snapshot tutorial.)
  • Check disk space: A full disk turns queue issues into corrupted writes and cascading failures.
  • Check time sync: Bad system time breaks TLS validation and can cause repeated deferrals.

Quick commands (Postfix or Exim hosts)

df -h
free -m
uptime
journalctl -p warning --since "2 hours ago" | tail -n 80

If /var or / is above ~90%, fix space pressure before you touch the queue.

Oversized logs are a frequent cause.

If you need it, follow this log rotation tutorial to rotate and reclaim space safely.

VPS email queue troubleshooting tutorial: identify what’s piling up (and why)

Queue work is mostly pattern recognition. Look for three things: the sender(s), the recipient domains, and the error text that repeats across messages.

1) Determine which MTA you’re running

ps -eo comm | egrep 'postfix|exim' | sort -u
  • If you see master, smtpd, qmgr under postfix, you’re on Postfix.
  • If you see exim processes, you’re on Exim (very common with cPanel).

2) Get a queue size and a “top talkers” view

Postfix:

mailq | tail -n 1
postqueue -p | head -n 40

Count deferred vs active quickly:

postqueue -p | egrep -c '^[A-F0-9]'
postqueue -p | egrep -ci 'deferred'

Exim:

exim -bpc
exim -bp | head -n 40

Next, extract the repeating domains and the repeating failures. This is usually where the “why” becomes obvious.

Postfix (recipient domains):

postqueue -p | awk '/@/{print $NF}' | sed 's/.*@//' | tr -d '>' | sort | uniq -c | sort -nr | head

Exim (recipient domains):

exim -bp | awk '/<=/{next} /@/{print $NF}' | sed 's/.*@//' | tr -d '>' | sort | uniq -c | sort -nr | head

Postfix (common error lines):

grep -E "status=(deferred|bounced)" /var/log/mail.log | tail -n 200

Exim (common error lines):

grep -E "retry time not reached|frozen|defer" /var/log/exim/mainlog | tail -n 200

By now you should see a clear theme. Common themes include DNS failures, TLS handshake problems, policy blocks, rate limits, and authentication issues.

Fix the four causes that create most stuck queues

A growing queue is a symptom. Fix the cause first.

After that, release mail in a controlled way.

Cause #1: DNS problems (A/AAAA, MX, resolver timeouts)

If you see Host or domain name not found, Temporary failure in name resolution, or long connect delays, start with DNS and your resolver.

resolvectl status 2>/dev/null || cat /etc/resolv.conf
getent hosts gmail.com
dig +short mx gmail.com
dig +trace yourdomain.com | tail -n 30
  • If your VPS is using a flaky or blocked resolver, switch to a reliable resolver (or your provider’s recommended DNS) and retest.
  • If you recently moved mail hosting, re-check MX and cutover steps. For a clean change process, use this: MX record setup tutorial.

Cause #2: TLS/STARTTLS failures (certificate chain, hostname mismatch, old ciphers)

Deferrals often hide a TLS failure, especially as providers tighten requirements. Watch for SSL_accept error, handshake failure, or certificate verify failed in your logs.

Start by testing your local SMTP TLS:

openssl s_client -starttls smtp -connect localhost:25 -servername $(hostname -f) </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates

Then test a remote MX directly (example with Gmail):

dig +short mx gmail.com | head -n 1
# Use one of the returned hosts, then:
openssl s_client -starttls smtp -connect gmail-smtp-in.l.google.com:25 </dev/null | head -n 20

If the queue grew right after a cert/SSL change, re-check the certificate chain and renewal state.

For a careful migration workflow on the web side, follow: VPS SSL certificate migration tutorial.

Cause #3: Remote rate limits and policy blocks (4xx deferrals)

Most large providers “soft block” before they hard block. You’ll see 4xx responses like 451 or 421.

The text often says “try again later”, “rate limited”, or “temporarily deferred”. Treat that as a signal to slow down, not to retry harder.

What works in practice:

  • Slow down retries (Postfix) so you aren’t reconnecting constantly.
  • Reduce concurrency to large providers until the queue stabilizes.
  • Stop the spike at the source (compromised account, broken contact form, plugin loop).

Postfix: safer, temporary throttling (example)

postconf -e 'default_destination_concurrency_limit = 5'
postconf -e 'smtp_destination_concurrency_limit = 2'
postconf -e 'smtp_destination_rate_delay = 2s'
systemctl reload postfix

These are intentionally conservative recovery values. Once deliveries are steady and deferrals drop, adjust upward carefully.

Exim: quick visibility into deferrals

exim -bp | grep -i "defer" | head -n 50

On cPanel servers, don’t guess. Use WHM’s Email tools plus the Exim logs to find the sending account.

If you need a baseline for SPF/DKIM/DMARC/TLS/rDNS, use: Email deliverability setup guide.

Cause #4: HELO/EHLO and hostname failures (common with new VPS builds)

Some receivers reject mail if your server announces a generic hostname, a mismatched FQDN, or a name that doesn’t resolve.

The bounce text often mentions “Bad HELO” or a policy rejection tied to identity.

Check what your server is presenting:

hostname
hostname -f
postconf myhostname 2>/dev/null || true

For a focused fix path, follow: SMTP HELO/EHLO hostname fix tutorial.

Pinpoint the sender: find the account, site, or script causing the queue

On multi-tenant servers, “mail is stuck” often really means “one account sent 50,000 messages.” Get evidence before you disable anything.

Postfix: map queued messages back to SASL user or local sender

Grab a queue ID, search for it in the logs, and read the surrounding lines. You’re looking for auth details and the real sender.

# Pick a queue ID from mailq/postqueue -p, then:
grep -R "YOURQUEUEID" /var/log/mail.log* | tail -n 50

Pay attention to:

  • sasl_username= (authenticated SMTP submission)
  • from=<user@domain> patterns
  • local web app mailers (PHP mail, sendmail wrapper)

cPanel/WHM (Exim): identify the sender quickly

On cPanel servers, the Exim mainlog plus message headers usually tell you who sent the mail and how.

This also pairs well with malware triage on shared/reseller nodes.

Control the blast radius: pause, freeze, and clean without losing legitimate mail

Once you know the source, stop new bad mail first. Then deal with the existing queue.

This prevents an endless loop of “fix, retry, re-break”.

Postfix: temporarily stop accepting new inbound mail (optional)

If inbound spam or backscatter is piling on while you troubleshoot, add some breathing room.

postconf -e 'smtpd_client_connection_count_limit = 10'
postconf -e 'smtpd_client_connection_rate_limit = 30'
systemctl reload postfix

If the incident is outbound spam, focus on outbound controls and compromised accounts. Inbound throttles won’t fix that.

Exim: freezing messages (common on cPanel)

Frozen messages won’t retry until you unfreeze them. They often point to hard failures, routing mistakes, or repeated policy blocks.

exim -bp | grep frozen | head

If one sender is clearly abusive, you can remove their mail by pattern (be careful on production):

# Example: remove queued messages from a sender address
exiqgrep -i -f badsender@yourdomain.com | xargs -r exim -Mrm

Don’t delete big batches unless you’re sure they’re spam or malicious.

If the messages are legitimate transactional mail, fix the cause and let normal retries work.

Release the queue safely after the fix

You’re not aiming for “queue = 0.” You’re aiming for stable delivery.

Stability also means you don’t trigger a new wave of deferrals or blocks.

Postfix: re-queue and flush in a controlled way

# Re-queue (can help after config fixes)
postsuper -r ALL

# Flush the queue (forces a delivery attempt)
postqueue -f

If you added throttling during recovery, leave it in place for a few hours. Watch the logs.

Confirm the old error pattern is gone before you relax limits.

Exim: force retry for selected messages

# Retry all messages in queue
exim -qff

On busy systems, avoid hammering aggressive retries on a loop. It usually makes rate limiting worse.

Quick diagnostics: what the most common queue errors really mean

  • “Temporary failure in name resolution”: your resolver is failing or blocked; fix DNS first.
  • “Connection timed out”: outbound port 25 may be blocked, the remote host is unreachable, or you have routing/firewall trouble.
  • “Relay access denied”: submission/auth is misconfigured, or an app is trying to relay without auth.
  • “TLS is required, but was not offered”: the remote requires STARTTLS; make sure your MTA offers modern TLS and your time/certs are correct.
  • “Rejected for policy reasons”: usually SPF/DKIM/DMARC alignment or reputation. Fix auth and sending behavior before retrying.

Hardening steps that prevent queue meltdowns next week

Queue incidents repeat when there are no guardrails. A few small changes keep mail problems smaller. They also make recovery faster.

1) Set practical outbound rate limits

You don’t need enterprise tooling to stop a runaway script from taking the server down.

Basic per-user or per-connection limits reduce the damage.

  • On Postfix, enforce authenticated submission on 587 and keep 25 for server-to-server traffic.
  • On cPanel/WHM, review per-domain sending limits and watch for sudden spikes.

2) Monitor queue size and alert early

Pick a threshold you can act on. Alert on sustained growth, not brief bursts.

For many small-business servers, “queue > 200 for 15 minutes” is a solid starting point.

If you want lightweight monitoring that fits a VPS, add alerting and a simple dashboard. This pairs well with: VPS monitoring setup tutorial.

3) Keep logs readable and retained

Queue debugging lives and dies by logs. Rotate them, compress them, and keep at least 7–14 days.

If /var keeps filling up, fix retention and compression instead of deleting logs in a panic.

Where HostMyCode fits (and why it matters for mail stability)

Queues pile up faster on underpowered servers. CPU pressure slows TLS handshakes. Low RAM increases I/O churn.

Slow disks stretch every delivery attempt. If you run business email, give it consistent resources.

For a clean mail VPS build (or to run mail alongside web apps), start with a HostMyCode VPS sized for steady outbound throughput and reliable DNS resolution.

If you don’t want to manage OS updates, firewall rules, and MTA tuning during incidents, managed VPS hosting is a practical option.

If queue problems keep returning, you’re usually dealing with tight resources, noisy-neighbor contention, or missing guardrails (rate limits, monitoring, and backups). A HostMyCode VPS gives you dedicated resources and predictable performance, while managed VPS hosting helps you keep mail, DNS, and security changes controlled as you grow.

FAQ: VPS mail queue fixes that admins ask for under pressure

Should I delete the whole mail queue to “fix” delivery?

No. Deleting the queue removes evidence and can delete legitimate mail. Fix the root cause, then retry gradually. Only remove batches you’ve verified as spam or malicious.

What if outbound port 25 is blocked from my VPS?

Then your server can’t deliver directly to other mail servers. Use authenticated submission on 587 to a relay, or move mail delivery to a VPS/provider that allows proper outbound SMTP. Don’t keep retrying; you’ll only grow the queue.

How do I stop a single compromised website from flooding the queue?

Disable the account or application mailer first, then clean the site. On hosting servers, enforce per-account limits and prefer authenticated SMTP submission over PHP’s mail() defaults.

My queue is mostly Gmail/Microsoft deferrals. What’s the fastest win?

Slow down delivery attempts (concurrency and rate delay), confirm SPF/DKIM/DMARC alignment, and stop sudden spikes. Then retry steadily.

If you’re seeing hostname/HELO issues, correct that before sending again.

What’s a reasonable queue alert threshold for a small-business VPS?

Alert when the queue grows and stays elevated, not on brief spikes. A common starting point is >200 messages for 15–30 minutes, then tune based on normal sending volume.

Summary: your repeatable queue recovery checklist

  • Confirm disk space, load, and logs are healthy before touching the queue.
  • Identify the pattern: recipient domains and repeated error text.
  • Fix the root cause (DNS, TLS, policy/rate limits, hostname/HELO, auth).
  • Stop the source of volume (compromised site, broken script, misconfigured relay).
  • Retry gradually with throttling still enabled, then relax limits after stability returns.

If you’re planning to move mail to a new server to escape repeated deliverability problems, use a controlled migration plan and avoid data loss.

Pair this tutorial with a stable hosting base like managed VPS hosting so queue incidents don’t turn into weekly fire drills.

VPS Email Queue Troubleshooting Tutorial (2026): Find Stuck Mail, Fix Deferrals, and Restore Deliverability Fast | HostMyCode