Subscribe a batch of mailaddresses to mlmmj

This small and simple perl script will iterate over a textfile with mailaddresses. For each address (one line in that file), it will execute the subscription command.

#!/usr/bin/perl -w

$FILE = "list.txt";
open(FILE) or die("Could not open file.");
foreach $line () {
   # do line-by-line processing.
   @command="sudo /usr/bin/mlmmj-sub -L /var/spool/mlmmj/listname/ -a ".$line;
   `@command`;
}
close(FILE);

Todo: make it accept arguments for mailinglist-name and for the filenalme to read from; Also make it accept stdin instead of a file.

This article was published on webschuur.com. And migrated to this blog.

in

About the author: Bèr Kessels is an experienced webdeveloper with a great passion for technology and Open Source. A golden combination to implement that technology in a good and efficient way. Follow @berkes on Twitter. Or read more about Bèr.

blog comments powered by Disqus