#!/usr/local/bin/perl # when majordomo mail bounces, shove it through this # and it generates a list of commands to unsubscribe all the failed addresses print "finding email addresses\n" ; $removefrom = "inference" ; open (TMP, "> tmpd" ) ; $attentive = 1 ; while ( <> ) { # Rule to start ignoring the input if (($attentive) && ((/opy of the [Mm]essage/) || (/ranscript of session follows/)|| (/text was generated/) )) {# stop reading when message is quoted. $attentive = 0 ; } # Rule to pay attention again (new message in list) if (!$attentive) { if ((/following addres/)) { $attentive = 1 ; } } # what to do. if ($attentive) { if (!(/From/) # ignore from lines && ( /[\s\<]?([\w.-]+\@[\w.-]+)[\s\>]?/ )) { # print $1,"\n" ; $_ = $1 ; if (!(/ajordom/)) { if(/\b([\w.-]+)\@mrao/ ) { $removefrom = $1 ; # probably reporting a failure to do with this list $removefrom =~ s/owner-// ; $removefrom =~ s/-list// ; } else { # remove this (buit only once) $doit = "major unsubscribe $removefrom $_\n" ; if ( $done{$doit} ) { } else { $done{$doit} = 1 ; print TMP $doit ; print $doit ; } } } }} } close(TMP); print "source tmpd \n" ; end