Thursday, September 13, 2007

Using mailman and bash to show list subscriptions suspended for bounces

If mail to a mailman mailing list subscriber bounces too many times, further deliveries to that address are suspended. It's often useful to track down these addresses.

# cd /usr/local/mailman/bin/
# for i in `./list_lists -b`; do echo : $i : >>/tmp/bounced.txt;./list_members --fullnames --nomail=bybounce $i >>/tmp/bounced.txt;done

The contents of the file will look like this:

: 2007-announce :
: 2007classgift :
: 2008-announce :
: 2009-announce :
: 2010-announce :
First Last <NETID@emory.edu>
First1 Last1 <NETID1@emory.edu>
: 505a-0ac-5079 :

Then you can investigate why mail to the two members of the 2010-announce list has been bouncing.

To mail a copy of the output file to yourself from the command line, do this:

# mail -s 'Bounces' YOURNAME@YOURDOM.AIN </tmp/bounced.txt

The key to all this is the "./list_lists -b" in the script fragment above. This gives you a bare listing of all the lists in the system. That gets fed back into the script to locate the held messages. Mailman shines at the command line.

No comments: