IT Knowledge Base

Technical Repository

Postfix – Useful Commands

1. Give an approximation of the number of emails in the mailq.

mailq | wc -l

2. 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

postconf -e defer_transports=smtp; sudo postfix reload

3. Unpause mail delivery… resume email delivery after it has been paused (previous tip)

postconf -e defer_transports=; sudo postfix reload; sudo postfix flush

4. Clear all emails in the mail queue

postsuper -d ALL

5. Delete one email with id [msgid]; previously obtained with a command such as mailq|grep -i [string] or mailq|more

postsuper -d [msgid]

6. After any changes to the configuration the server has to be reloaded to read the new configuration

postfix reload

7. Flush the mail queue… to help postfix resume delivery faster after it has been paused such as after the computer reconnected

postfix -f

Leave a Reply