deletemailqueue with the /go/deletemailqueue Command

/go/deletemailqueue empties the Postfix mail queue in one step. Use it when the queue is full of unwanted mail, for example after a compromised account or a script has sent out spam, and you want a clean start. To remove only undeliverable mail, use undelivered instead. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Check what is in the queue first
mailq | tail -n 1

# Delete everything in the queue
/go/deletemailqueue

Examples

# Count the queued messages before and after
mailq | tail -n 1
/go/deletemailqueue
mailq | tail -n 1

# Find out who is sending the mail first
/go/mailtop
/go/subjecttop

# Delete just one message instead of the whole queue
mailq
sudo postsuper -d <queue-id>

Output

Deleting mail queue...
postsuper: Deleted: 1284 messages
postsuper: Deleted: 0 messages

The first line is printed by the command. The postsuper lines come from Postfix and show how many messages were removed. The exact wording can vary by Postfix version. The second count is normally 0, because the first step has already removed everything (see What it does).

If the queue was already empty, both counts are 0.

See the full reference at /go/deletemailqueue and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *