useful postfix one liners
Postfix is a very good MTA (mail transport agent), here are some quick commands that help with queue management:
sudo mailq|wc -l – give an approximation of the number of emails in the mailq in the number at the beginning of the line
sudo postconf -e defer_transports=smtp;sudo postfix reload : pause email delivery but still accept email. May be useful when needing to queue a large number of mail at once or when a mail needs to be deleted from the mail queue without stopping the mail server
sudo postconf -e defer_transports=;sudo postfix reload;sudo postfix flush : unpause mail delivery… resume email delivery after it has been paused (previous tip)
postsuper -d ALL : clear all emails in the mail queue
postsuper -d [msgid] : delete one email with id [msgid]; previously obtained with a command such as mailq|grep -i [string] or mailq|more
postfix reload : after any changes to the configuration the server has to be reloaded to read the new configuration
postfix -f : flush the mail queue… to help postfix resume delivery faster after it has been paused such as after the computer reconnected
