z6c - personal blog about topics

Christian Müller – Letzte Änderung: 07.12.2015 14:48 Uhr

Shell Shortcuts For Mail Missmanagement

Wenn die Mail Queues volllaufen:

Aus aktuellem Anlaß, ... :-(

Manuelles Löschen der Dateien in der Queue

grep -l email@domain.com * | xargs rm

Oder

for file in $(grep -l email@domain.com *); do
    rm -i $file;
    #  ^ prompt for delete
done

(Von Stackoverflow)

Do you need to cleanup a postfix mail queue?

To delete all email from one specific email address, or all email From: a specific domain name, please choose the appropriate command from the following list.

To delete all email in the queue from a domain run this command as root:

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -

To delete all email in the queue From: a specific email address run this command as root:

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /username@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -

(Von emailquestions.com)

Wie voll ist die Queue überhaupt?

mailq | grep -c "^[A-F0-9]"

Alle Mails löschen

Alle Emails löschen:

postsuper -d ALL

(Von Michael Kaiser)

How to flush postfix mail queue and its various operations

(Von LinuxServerWorld):

Flushing a mail queue:

In order a flush a mail queue, run the following command

# postfix flush

or

# postfix -f

or

# postqueue -f

Moving mails to hold queue:

Sometimes there may be a situation that we need move all mails to hold queue and then release at later time for resending. So run the following command to move the mails from deferred, active to hold queue.

# postsuper -h ALL

Here it moves all mails on active, incoming and deferred queue to hold queue.

Also you can move the mails from a particular queue to hold queue by using the following command.

# postsuper -h ALL deferred

To release all the messages from hold queue, run the following command

# postsuper -H ALL

Requeue mails in a mail queue:

In order to requeue the mails in a mail queue, run the following command

# postsuper -r ALL

By default it will requeue all the mails in active, deferred, hold and incoming queue, then it place all those mails to maildrop queue for delivery.

Deleting mails from postfix queue:

To delete a mail from particular mail queue, then run the following command

# postsuper -d ALL deferred

or

# postsuper -d ALL active

The above command will delete mails from the specified queue.

Here is another option to delete all mails from all mail queue

# postsuper -d ALL

Kommentare / Diskussion: