November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Postfix Useful Commands

To Check Postfix Queue
#mailq

To Check Sasl Auth
#tail -f /var/log/messages|grep sasl

To Check Posfix Logs
#tail -f /var/log/maillog|grep postfix

List of domains that are being deferred
#qshape-maia -s deferred

Checking Specific Mail From Queue
—————————————
To view the full mails
#postcat -q D5EB71AEA45
If you an error postcat: fatal: open queue file D5EB71AEA45: No such file or directory, Then it means mail has been delivered or removed using postsuper

If you want to remove specific mail from queue
#postsuper -d D5EB71AEA45

Sorting Queued Mails By From Address:
# mailq | awk ‘/^[0-9,A-F]/ {print $7}’ | sort | uniq -c | sort -n

Removing Mails Based On Sender Address
# mailq| grep ‘^[A-Z0-9]’|grep peggysj@msn.com|cut -f1 -d’ ‘ |tr -d \*|postsuper -d –

or, if you have put the queue on hold, use
# mailq | awk ‘/^[0-9,A-F].*capitalone@mailade.com/ {print $1}’ | cut -d ‘!’ -f 1 | postsuper -d –
to remove all mails being sent using the From address “capitalone@mailade.com”.

if you want to remove all mails sent by the domain msn.com from the queue
#mailq| grep ‘^[A-Z0-9]’|grep @msn.com|cut -f1 -d’ ‘ |tr -d \*|postsuper -d –

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>