New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
TroubleshootingUpdated 26 Oct 2026

Reading SMTP and Postfix Mail Logs: Status Codes, Queue IDs and Tracing a Message End to End

How to read Postfix and general SMTP logs: log line anatomy, queue IDs, status values, reply codes, tracing one message, common patterns for deferrals and bounces, useful commands and what to collect for support.

TK
Written by Tomasz Kowalski
Infrastructure and Reliability Engineer
Reviewed by Ethan Brooks
  • Published14 Apr 2025
  • Read time7 min
  • Length1,418 words
Share this guide

When a message vanishes, the mail log is the first and best witness. Every mail transfer agent records what it received, what it tried to deliver, what the remote server answered and what it finally did. Postfix is among the most common MTAs and its logs are compact, consistent and easy to search once you recognise the pattern. This guide uses Postfix lines as examples, but the same ideas apply to Exim, Sendmail and the logs of managed relays: find the message identifier, follow it through each step, read the remote reply and decide whether the problem is yours, the recipient's or in between. It complements managing the mail queue, tracing messages and SMTP reply codes.

KeyThe queue ID ties together every log line for one message
Statussent, deferred, bounced, expired and rejected tell you the outcome of each attempt
Remote replyThe text inside parentheses after status is the other server's own answer
MethodSearch by recipient or queue ID, follow the story, then act on the reply code

Where the logs live

SystemTypical location or command
Debian and Ubuntu with rsyslog/var/log/mail.log (and mail.err)
RHEL and derivatives/var/log/maillog
systemd journaljournalctl -u postfix (the unit may be postfix@- on newer packages)
ContainersThe container stdout, or the configured syslog target
Managed relayThe provider's message log or event API. See events

Anatomy of a log line

Apr 14 10:02:11 mx1 postfix/smtpd[2214]: 4F1A2C0B7E: client=app1.example.com[203.0.113.10], sasl_method=PLAIN, [email protected]
Apr 14 10:02:11 mx1 postfix/cleanup[2219]: 4F1A2C0B7E: message-id=<[email protected]>
Apr 14 10:02:11 mx1 postfix/qmgr[1190]: 4F1A2C0B7E: from=<[email protected]>, size=5120, nrcpt=1 (queue active)
Apr 14 10:02:12 mx1 postfix/smtp[2230]: 4F1A2C0B7E: to=<[email protected]>, relay=mx.gmail.example[198.51.100.7]:25, delay=1.1, delays=0.05/0.01/0.5/0.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1713088932 x12si1234)

Reading from left to right: timestamp, host, the Postfix component and its process ID, the queue ID, then key=value fields. The components tell you the stage: smtpd received a connection, cleanup processed the message and added headers, qmgr scheduled it, smtp delivered it to the next hop, bounce generated a failure notice. Fields you will use most:

FieldMeaning
client=The connecting host and IP that submitted the message
sasl_username=The authenticated user, if any
message-id=The Message-ID header; useful to match what the sender sees
from=<>The envelope sender. An empty address marks a bounce. See the null sender
to=The envelope recipient for this delivery attempt
relay=The next-hop server and port, or "none" if no connection was made
delay= and delays=Total time and its parts: before queue manager / in queue manager / connection setup / transmission
dsn=Enhanced status code (2.x.x success, 4.x.x temporary, 5.x.x permanent)
status=sent, deferred, bounced, expired, or other outcome
text in parenthesesThe remote server's reply, which usually contains the real explanation

The status values

StatusWhat it meansWhat to do
sentThe next hop accepted the message (a 250 reply)Delivery to the next server succeeded; for relays "sent" only means handed on
deferredTemporary failure; Postfix will retryRead the reply: greylisting, rate limiting, DNS or connection problems
bouncedPermanent failure; a non-delivery report goes to the senderFix the cause (bad address, policy, authentication) and resend
expiredRetries exceeded the maximal queue lifetimeInvestigate why it stayed deferred. See the queue
rejected (NOQUEUE reject)Refused at SMTP time by your own server, before queueingCheck restrictions, authentication or the client IP
milter-reject / policyA filter refused the messageLook at the filter that produced the text

Tracing one message

  1. Find the queue ID. Search by recipient: grep "to=<[email protected]>" /var/log/mail.log, or by Message-ID.
  2. Collect all lines for that ID. grep 4F1A2C0B7E /var/log/mail.log returns receipt, queueing and every delivery attempt in order.
  3. Check the receipt step. Who submitted it, was authentication used, and did the client IP match what you expect?
  4. Check each delivery attempt. Note the relay host, the dsn value and the remote text.
  5. Follow bounces. A bounce message has its own queue ID; the line with from=<> links back to the original through the text of the report.
  6. Compare timestamps. Long gaps between attempts point to queue backoff; long delays in the second figure of delays point to a slow queue manager; large last figures point to a slow remote server.
  7. Decide the owner. Reply codes 4xx and 5xx from the remote host usually mean the remote side or your reputation; local errors (no route, DNS failure, connection timed out) mean your network or configuration.

Common patterns and their meanings

Log text (shortened)Likely causeNext step
status=deferred (host mx... said: 421 4.7.0 Try again later, rate limited)Provider throttling your IP or domainSlow the rate; check reputation. See 421 errors
status=deferred (connect to ...: Connection timed out)Firewall, port 25 blocked, remote outageTest with telnet or openssl from the server
status=bounced (host ... said: 550 5.1.1 User unknown)Recipient does not existRemove the address
status=bounced (550 5.7.1 ... blocked / listed)IP or domain on a blocklist or policy refusalUse the blocklist check and follow the removal steps
status=bounced (550 5.7.26 ... authentication)SPF/DKIM/DMARC failureCheck records. See Authentication-Results
status=deferred (Host or domain name not found)DNS failure for the recipient domainCheck resolver settings and recipient domain
NOQUEUE: reject: RCPT ... Relay access deniedClient not allowed to relayFix authentication or restrictions. See open relay checks
SASL LOGIN authentication failedWrong credentials or brute forceCheck for repeated attempts. See brute-force defence
TLS library problem or certificate verify failedCertificate or protocol mismatchReview TLS settings. See certificates
warning: ... queue file write error / disk fullLocal storage problemFree space and requeue

Useful commands

# Count statuses today
grep "status=" /var/log/mail.log | grep -o "status=[a-z]*" | sort | uniq -c

# Top remote error reasons for deferrals
grep "status=deferred" /var/log/mail.log | sed -E "s/.*\(([^)]*)\).*/\1/" | sort | uniq -c | sort -rn | head

# Messages queued now
postqueue -p | tail -n 1

# Details for one queued message
postcat -q 4F1A2C0B7E | head -40

For heavy volume use log analysers or ship logs to a central store so you can search by recipient domain and status over time. Keep logs long enough to cover the retention you promise customers and for investigating delayed complaints. Mask personal data where policy requires and restrict who can read the logs.

Reading delays

The delays field is a compact timeline with four numbers in seconds. The first is time before the queue manager, including receipt and cleanup. The second is time waiting in the queue manager. The third is connection setup, including DNS, the TCP handshake and TLS. The fourth is the actual transmission of the message and the remote reply. A large first value suggests a busy or slow content filter on your side, a large second value suggests a backlog or retry waiting, a large third value points to DNS or network trouble and a large fourth value means the remote server was slow to accept the data or to respond after it. If many messages show the same slow stage, look at that stage rather than at individual messages. Compare delays for different recipient domains: when only one domain is slow, the cause is probably at that domain, and when every domain is slow, it is most likely your own server, resolver or network.

Logging for relays and APIs

If you send through a relay or API, you do not have the relay logs on your server, but you still keep your own application log. Record the message identifier returned at submission time, the recipient and the time, so you can match it later with the relay events for that identifier. A short line in the application log, with the identifier and the result of the submission, often saves hours of searching. Where the relay offers webhooks, store the delivery, bounce and complaint events together with that identifier, so one search shows the whole lifecycle in a single place.

What to send when asking for help

  • All log lines for the queue ID, from receipt to final status.
  • The full SMTP reply text, including the enhanced status code.
  • The sending IP, the recipient domain and the time with timezone.
  • The original message headers if you have them.
  • What changed recently: a new IP, DNS update, software upgrade or sending campaign.

With the queue ID in hand a mail log tells a clear story: who submitted the message, what you tried and exactly what the other server said. Learn to read that story quickly and most delivery problems become routine.

Test your sending path Check records and blocklists before digging into logs.

Open the blocklist check

References and further reading

Frequently asked questions

What is a Postfix queue ID?

A unique identifier assigned to a message in the queue; every log line for that message carries it so you can follow it.

What is the difference between deferred and bounced?

Deferred is a temporary failure that Postfix retries; bounced is a permanent failure that generates a non-delivery report.

Where do I find the reason for a failure?

In the text in parentheses after status, which holds the remote server reply, and in the dsn enhanced status code.

Does status=sent mean the recipient received it?

No. It means the next server accepted it. Later filtering may still place it in spam or discard it.

How do I trace one message?

Find its queue ID by searching the recipient or Message-ID, then grep every line with that ID.

Topics#logs#postfix#smtp#troubleshooting#queue
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales