Moorfleeter Deich 216, 22113 Hamburg
+49 1774661716info@bastcom.deMon–Fri: 09:00–18:00

Blog

ITWeb Knowledge

Tech news, AI and practical knowledge – around WordPress, Joomla, hosting and web development.

Postfix Flush the Mail Queue

← Back to the blog

Introduction

Postfix is a widely used mail transfer program (MTA) that is used for managing and sending emails. Messages may need to be suspended or deleted in the queue. This guide will help you to manage the mail queue with Postfix, view messages and, if necessary, delete them.

1. Empty mail queue

In Sendmail, the command sendmail -q used to empty the mail queue. In Postfix, use the following command instead:

postfix flush

Alternatively, the following command can be used:

postfix -f

2. Show mail queue

To view all emails in the queue, use the following command:

mailq

3. Remove emails from queue

If you want to delete all messages from the queue, use this command:

postsuper -d ALL

4. Remove delayed emails only

To delete only the messages in the “Deferred Queue”, enter the following command:

postsuper -d ALL deferred

With these commands, you can efficiently manage the postfix queue and intervene quickly in case of problems.