mailer.pl (C) 1997-2000 Stuart Caie INSTALLATION ============ Copy this script and some lists of email-addresses into a directory. Next you'll need to set up a .forward file to run a filter on your mail, which can execute this script safely on mail destined for it. I suggest using an extension to your address (bla+mylist@bla.com) or using a free remailer (bla@iname.com) for having mail sent to, thus people sending you private email won't have it sent to everyone on your list. Example filter-rules for 'filter' (provided with elm): if (to "blah@iname.com") then execute /usr/local/bin/perl $HOME/list/mailer.pl Example procmailrc for procmail: :0 * ^TO_blah@iname.com | /usr/local/bin/perl $HOME/list/mailer.pl Where '/usr/local/bin/perl' is your own full path to perl, and '$HOME/list/mailer.pl' is the path to the script. If you haven't got one already, you will need to install a .forward file to run these filters, which will automatically dump mail in your mailbox if none of the rules you give them apply. CONFIGURATION ============= There are 4 lines at the top of the script: my $CONFDIR = "$ENV{'HOME'}/list"; my $SENDMAIL = '/usr/sbin/sendmail -t -i'; my $DEFGROUP = 'all'; my @GROUPS = qw(jasmine kitty); CONFDIR is the directory where all the lists of email-addresses are held. In this case, I have a sub-directory called 'list' in my home directory. SENDMAIL is the correct invocation of a command (and possible args needed) to send a mail given on standard input to the list of people stated in the mail. Therefore the command must enable reading headers and parsing/removing Bcc: recipients. DEFGROUP is the default list from which to take email-addresses. In this case, the file '$HOME/list/all' would be a file containing email address. GROUPS is a set of all the other groups that this mailer will send out to. In this case, '$HOME/list/jasmine' and '$HOME/list/kitty' are also files with email addresses listed in them. A user sending a mail to list can choose which group by writing the name of the group with a colon in the subject line. It only works for groups that exist, so having the 'Re:' or 'Fw:' sign prepended by email programs will not affect this choice. Just be sure not to have a group called 're' or 'fw'. In our example, I could write 'Subject: JASMINE: who is she?', and my mail would be sent to the people in the 'jasmine' list. EMAIL LIST FILES ================ Each email list file (as detailed above) should have one email address per line. You can use the form , "bla@bla.com" or 'bla@bla.com', or even the bare bla@bla.com - the only rule is you *must* have only one email address on a single line. You may use the '#' or ';' characters to mark the rest of the line as a comment. # $HOME/list/all kevin@hotmail.com ; Kevin Rancid ; James Poo ;poobear@sys.org ; not part of the list anymore jasmine@secret.net ; Jasmine Poo kitty@meow.org kitty2@meow.org # $HOME/list/jasmine jasmine@secret.net ; Jasmine Poo ; James Poo # $HOME/list/kitty kitty@meow.org kitty2@meow.org