Find all Postfix deliveries sent to an email address
Build a paste-ready command, then review its compatibility and effects before running it.
awk -v recipient=<recipient-email> 'index($0, "to=<" recipient ">")' /var/log/mail.logComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Postfix text logsMatches recipient delivery records regardless of sent, deferred, bounced, or other status values.
Operational knowledgereview due 2027-01-19
Requirementsawkawk must be installed and available on PATH.
Version supportawk Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsJul 23 09:18:33 mail postfix/smtp[2208]: 4D92A2F18C: to=<bob@example.net>, relay=mx.example.net[198.51.100.24]:25, status=sent (250 2.0.0 queued)Representative successful output; values vary with the selected target and system state.
Known errorsawk: command not foundawk is missing or is not available on PATH.
Verifyawk -v recipient={{recipient}} 'index($0, "to=<" recipient ">")' {{logFile}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01awkCommandRuns the awk stage of this one-liner.
02-vOptionAssigns the following name and value before the awk program runs.
03recipient=<recipient-email>ParameterA value supplied in the Fill parameters section.
04'index($0, "to=<" recipient ">")'ArgumentPasses 'index($0, "to=<" recipient ">")' to awk.
05<postfix-log-file>ParameterA value supplied in the Fill parameters section.
Example input
awk -v recipient=bob@example.net 'index($0, "to=<" recipient ">")' /var/log/mail.log
Example output
Jul 23 09:18:33 mail postfix/smtp[2208]: 4D92A2F18C: to=<bob@example.net>, relay=mx.example.net[198.51.100.24]:25, status=sent (250 2.0.0 queued)
Illustrative output — exact values vary by system and data.
Official sources
Related commands