Linux 4 All

Best Linux tricks source

Posts in the postfix category

Assuming you have a huge incoming mail queue and you need to remove it quickly, here is how:

cd /var/spool/postfix
service postfix stop
mv incoming incoming.spam
mkdir incoming
chown postfix.root incoming
chmod 700 incoming
service postfix start

Get mail queue

When dealing with mail issues, the following one-liner will display all Postfix mail IDs from the queue.

postqueue -p | egrep -v ^[[:space:]] | grep -v ^$ | awk '{print $1}' | grep -v ^\( | grep -v ^\- | sed -e 's/\*//g'