mailman: Reinject all pending mails from command line.

Mailman doesn’t have a command to re-inject all pending mails for the command line. Because in Debian Lenny the web-part is broken (wants to be recompiled because of wrong Apache group) I needed to re-inject a lot of mails which were pending.

WARNING: Use this only if you have a backup. This script is new and not tested on a wide basis. This means it can destroy all your data (including mails)! Use it on your own risk.

Lets assume you already discarded spam and other non-allowed mails via the discard command and what is leftover are mails which are now accepted by mailman, because you added the sender to the allow-list.

First you will need a handy script from Marius Gedminas: mmextract.py.

Put this script in /usr/lib/mailman/bin/mmextract.py in case you need this more than once. Next, save the following script also to /usr/lib/mailman/bin: reinject_and_discard.sh.

reinject_and_discard.sh

#!/bin/bash

for i in `ls heldmsg-codetracker-*`; do
    /usr/lib/mailman/bin/inject -l codetracker <(/usr/lib/mailman/bin/mmextract.py $i)     /usr/lib/mailman/bin/discard $i done

This script will discard the mail after it has been injected.

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.