[Mailman-Users] Mailman question - stale bounces

Jon Carnes jonc at nc.rr.com
Sun May 25 19:57:12 CEST 2003


I think this is already in the archives, but just in case, here is a
small script that you can run via cron to check for folks who have been
bounced out of your Mailman lists (due to excessive bouncing).

You could easily modify the script to remove the users email from the
list.  I leave that up to you.

=== mm_bounces ===

#!/bin/bash
# mm_bounces: sends an email of bounced folks to the mailman admin list
# Note, these bounced emails have been automatically set to "no mail"
# for the Mailman lists that they were a part of.

# create temp file to collect stats
TMPFILE=`mktemp /tmp/mm_stats.XXXXXX` || exit 1

# Note: this should be run on the first of the month
# The script checks for bounces from the previous month
MONTH="`date -d"last month" +%b`"

echo "A list of emails from $MONTH that were bouncing"    >$TMPFILE
echo "but are still subscribed to local Mailman lists."  >>$TMPFILE
echo "The addresses were automatically set to _no_mail_" >>$TMPFILE
echo "in the specified lists, due to the bounces."       >>$TMPFILE
echo "You should consider deleting these addresses from" >>$TMPFILE
echo "all Mailman lists:"                                >>$TMPFILE
echo "~mailman/bin/remove_members --fromall email at address" >>$TMPFILE
echo " "      >> $TMPFILE
echo "======" >> $TMPFILE

# We rotate our logs monthly on the first of each month at 4am
#  so we really only need to check last months bounce log: bounce.1
grep -hs "disabled " /home/mailman/logs/bounce.1 \
   grep -vs "already disabled" | \
   grep -s $MONTH | \
   cut -f6- "-d " |sort >> $TMPFILE

# Test to see if there was any output from the log
TEST="`tail -1 $TMPFILE`"
if [ "$TEST" = "======" ]; then rm $TMPFILE; exit 0; fi

# TEST indicated there were email addresses disabled last month
# So we need to send this message to admin at domain.com
cat $TMPFILE |mail -s "$MONTH: Mailman disable list" admin at domain.com

rm $TMPFILE

======

On Wed, 2003-05-21 at 00:58, John A. Kilpatrick wrote:
> I have a question about what happens when bounces are considered
> stale...does that mean that mailman resets the counter, or that the person
> is unsubscribed?
> 
> I would prefer to have mailman just remove someone.  I just went through a
> list migration and the nomail option wasn't carried over and a lot of people
> complained -  some were people who had bounced a long time ago.  I'd prefer
> just to auto-delete them.
> 
> Thanks,
> John
> 
> (p.s. this is mailman 2.1.2)





More information about the Mailman-Users mailing list