When in logs show messages like:
postfix/qmgr[2381]: warning: connect to transport relay: No such file or directory
postfix/qmgr[2381]: warning: connect to transport relay: No such file or directory
trinity last message repeated 2 times
you have emails unsent and should be deleted to clean postfix and avoid those annoying messages.
To do that, You can check inside /var/spool/postfix/defer and find the ID’s of deferred messages (inside defer folder a simple find will work). This folder contains more folders with numbering, inside some of them you might find files like:
/var/spool/postfix/deferred/3/556E5280E9
Or run # postqueue -p and check the headers where Queue ID is the ID of the mail
# postqueue -p Queue ID- –Size– —-Arrival Time—- -Sender/Recipient——- 556E5280E9 bla,bla bla,bla,bla sender bla,bla
Now we have the ID (556E5280E9) and we can take a look into this mail with:
# postcat /var/spool/postfix/deferred/3/556E5280E9
If we decide to delete it, run this command:
# postsuper -d [id]
like:
# postsuper -d 556E5280E9
you can also delete one message with the named queue ID from the named mail queue(s) (default: hold, incoming, active and deferred).
If a queue_id of – is specified, the program reads queue IDs from standard input.
For example, to delete all mail with exactly one recipient user@example.com:
# mailq | tail +2 | awk ‘BEGIN { RS = “” }# $7=sender, $8=recipient1, $9=recipient2 { if ($7 == “info@otherdomain.com” && $9 == “”) print $1 }‘ | tr -d ‘*!’ | postsuper -d -
Or by sender hostname
# mailq | grep senderhostname | awk ‘{ print $1′} | postsuper -d -
Or specify -d ALL to remove all messages; for example, specify -d
ALL deferred to delete mail in the deferred queue. As a safety measure, the word ALL must be specified in upper case.