Addemail.pl

From In The Wings
Revision as of 11:50, 16 August 2007 by Jka (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Script to add emails to mailing lists in mailman. Otherwise you would have to go through the web form, which could be a pain.

#!/usr/bin/perl

use strict;

my $mailman = "/usr/lib/mailman/bin";
my $listlists = "$mailman/list_lists";
my $add_members = "$mailman/add_members";


my $email = $ARGV[0];
my $list = $ARGV[1];
if (!$email) {
    print "Usage: addemail.pl <email address> <list name>\n";
    exit;
}

if (!$list) {
    print "No list name was given. The following lists are available:\n";
    system("$listlists");
    exit;
}

system("echo $email > /tmp/email.txt");
system("$add_members -r /tmp/email.txt $list");
system("rm /tmp/email.txt");