Skip to content

Latest commit

 

History

History
112 lines (66 loc) · 2.76 KB

Postfix.rst

File metadata and controls

112 lines (66 loc) · 2.76 KB

Postfix

Some useful links to explain the concepts of Postfix

Concepts

Configuration

SSL/TLS on Postfix

Troubleshooting & Log Parsing

Queue Management

Commands

  • Sorting queued mails by From address
sudo mailq | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n
  • Holding queued mails by From address
sudo mailq| grep '^[A-Z0-9]'| grep <sender-ID>| cut -f1 -d' ' | tr -d \*|sudo postsuper -h -
  • Holding queued mails by To address
sudo mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "<recipient>") print $1 } ' | tr -d '*!' | sudo postsuper -h -
  • Holding queued mails by Domain
sudo mailq| grep '^[A-Z0-9]'| grep @<domain>| cut -f1 -d' ' | tr -d \*|sudo postsuper -h -
  • Holding emails from the [active|deferred] queue based on subject
sudo find /var/spool/postfix/[active|deferred]/ -type f  -exec grep -il '<subject>' '{}' \; | xargs -n1 basename | sudo postsuper -h -
  • Removing Mails based on sender Address
sudo mailq| grep '^[A-Z0-9]'| grep <sender-ID>| cut -f1 -d' ' | tr -d \*|sudo postsuper -d -
  • Removing Mails based on Domain
sudo mailq| grep '^[A-Z0-9]'| grep @<domain>| cut -f1 -d' ' | tr -d \*|sudo postsuper -d -
  • Delete mails to a specific mail address
sudo mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "<recipient-ID>") print $1 } ' | tr -d '*!' | sudo postsuper -h -