I wanted to backup the member addresses of a few announcement lists I administrate. However, I don't have any shell access to the remote server they're running on -- I can only use the Mailman web interface. So I wrote the following small script which logs in, grabs the member management pages and extracts the e-mail addresses. You can use it e.g. in a cronjob to save the output or mail it somewhere else.
!/usr/bin/perl # mailman_members -- Extract member's e-mail # addresses out of Mailman's admin interface # Copyright (C) 2003 Christian Renz <crenz@web42.com> # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself use lib qw(/usr/home/crenz/lib/site_perl/5.6.1); use strict; use warnings; use WWW::Mechanize; # configure here my $name = 'My Mailing List'; my $url = "http://www.listhoster.net/mailman/admin/listid"; my $password = "42"; my @members = (); sub extract { # comparing link url to link text, to make sure Mailman's # interface hasn't changed push @members, map { $_->[1] } grep { $_->[0] =~ m|/([^/]+)--at--(.+)$| && "$1\@$2" eq $_->[1 +] } @_; } my $agent = WWW::Mechanize->new(agent => "mailman_members/0.01"); # get the login form $agent->get($url); $agent->field(adminpw => $password); $agent->submit(); # now logged in $agent->get("$url/members"); # first page extract($agent->links); my @chunks = grep { $_->[0] =~ m|/members\?chunk=| } @{$agent->links}; # get next pages foreach (1..scalar @chunks) { $agent->get("$url/members?chunk=$_"); extract($agent->links); } die "mailman_members: Found no members in list $name! Seems like somet +hing went wrong!\n" unless (scalar @members > 0); print scalar @members, " members in list $name as of ", scalar localti +me, ":\n\n", join "\n", # quick hack to sort by domain name sort { "$a|$b" =~ /\@([^|]+)\|.+\@(.+)$/; $1 cmp $2 } @members; # eof
In reply to Extract members of Mailman mailing list by crenz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |