Postfix
Postfix has the following relevant queues:
- Active: Email that is going to be delivered
- Deferred: Email that failed to be delivered, but is being retried until delivery succeeds.
- Hold: Email that was place on hold is not automatically retried.
Inspecting mail queues
The following will generate an overview of mails in the queues, grouped by sender:
kolabctl postfix mailq-count-senders
To get a quick count:
kolabctl postfix find /var/spool/postfix/deferred/ -type f -print | wc -l
Putting mails on hold by sender address
The following will move mails from a specific sender, that are currently in the active or deferred queue, to the hold queue.
kolabctl postfix mailq-put-on-hold $sender
To delete emails that are currently in the hold queue, by sender:
kolabctl postfix mailq-purge-hold-queue --from $sender --now
Print queued emails
Print all queued emails, from all queues.
kolabctl postfix postqueue -p
Delete emails from all queues by sender
To delete emails that are currently in any queue, by sender:
kolabctl postfix bash -c "postqueue -p | grep $sender | grep -oE '^[0-9A-F]{12}' | xargs -i postsuper -d {}"
Release emails from the hold queue
To release all emails in the hold queue:
kolabctl postfix postsuper -H ALL
Print a message by id
kolabctl postfix postcat -q $messageid
Process the mailqueue immediately
kolabctl postfix postqueue -f