[Mailman-Users] A script for changing subscriber/owner email domains

Ben Ostrowsky ostrowb at tblc.org
Thu Jun 28 17:40:50 CEST 2007


I didn't know any other way to do this, so I wrote a script.  Hope it's
not politically incorrect around here to have used Perl. ;)

Share and enjoy!

Ben


#!/usr/bin/perl -w

# Change all Mailman email addresses from one domain to another.
# Example: change_subscriber_domain tblc.lib.fl.us tblc.org

my $from  = $ARGV[0];
my $to    = $ARGV[1];

print "Old domain name: $from\n";
print "New domain name: $to\n\n";

open FH, "/usr/lib/mailman/bin/find_member --owners $from\$ |";

while (<FH>) {

  if (/^([^@]*).(.*) found in:/) {

    my $old = "$1\@$2";
    my $new = "$1\@$to";

    print "$old\n\t=> $new\n";

    $old =~ s/(['"])/\\$1/g;
    $new =~ s/(['"])/\\$1/g;

    system "/usr/lib/mailman/bin/clone_member --remove --admin --quiet
$old $new\n";
    print "--------------------\n";

  }

}


More information about the Mailman-Users mailing list