Skip to content

Postfix Mailqueue checken und Einträge löschen

Postfix Mailqueue nachschauen, ob von bubu@example.com Mails vorhanden sind.

root:~# mailq | grep -B2 'bubu@example.com'

BC416D3A1A   357793 Thu Oct 28 15:35:33  root@mail.example.com
(connect to mail.example.com[84.183.241.141]:25: Connection timed out)
                                         bubu@example.com
--
2FE3FD3A1C      376 Fri Oct 29 14:16:08  root@mail.example.com
(connect to mail.example.com[84.183.241.141]:25: Connection timed out)
                                         bubu@example.com
--
2A9EBD39F8    93717 Thu Oct 28 15:35:33  root@mail.example.com
(connect to mail.example.com[84.183.241.141]:25: Connection timed out)
                                         bubu@example.com
....

Mail mit der ID 2FE3FD3A1C und dem Befehl postsuper -d, Einträge aus der Postfix Mailqueue löschen.

root:~# postsuper -d 2FE3FD3A1C
postsuper: 2FE3FD3A1C: removed
postsuper: Deleted: 1 message

Um eine liste von Nachrichten in der Mailqueue mit einem Befehl zu löschen, können wir folgendes tun. Angenommen wir möchten alle Nachrichten von bubu@example.com löschen.

root:~# for id in $(mailq | grep -B2 'bubu@example.com' | awk '$0 ~ /MAILER-DAEMON/ {print $1}'); do postsuper -d ${id}; done