# 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.

Warnung

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.

#!/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</blockquote>
`