Here's a new Perl script, called "announce". It is a command, run by
the mailing list administrator, which will send an initial announcement
to the named mailing lists.
This is useful if you have created an initially "seeded" mailing list,
say from another existing list, and you wish all of the initial members
to be aware of the mailing list's new management.
Essentially, it performs the "&welcome" function from Majordomo on each
named mailing list, without the logging or password function.
Enjoy.
Alan
============================= cut here ===================================
#!/usr/local/bin/perl
# announce list ...
#
# Announce list to its members, giving instructions.
#
# This is almost the same as the "&welcome" message, except
# it is used to announce a list, which has its membership
# pre-initialized without actual "subscription" commands.
#
# Written by Alan Stebbens <aks@hub.ucsb.edu>, June 1994.
# $Source$
# $Revision$
# $Date$
# $Author$
# $State$
#
# $Locker: $
# set our path explicitly
# PATH it is set in the wrapper, so there is no need to set it here.
#$ENV{'PATH'} = "/bin:/usr/bin:/usr/ucb";
# What shall we use for temporary files?
$tmp = "/tmp/majordomo.$$";
# Before doing anything else tell the world I am majordomo
# The mj_ prefix is reserved for tools that are part of majordomo proper.
$main'program_name = 'mj_announce';
# Read and execute the .cf file
$cf = $ENV{"MAJORDOMO_CF"} || "/etc/majordomo.cf";
while ($ARGV[0]) { # parse for config file or default list
if ($ARGV[0] eq "-C") {
$cf = $ARGV[1];
shift(@ARGV);
shift(@ARGV);
}
elsif ($ARGV[0] eq "-l") {
$deflist = $ARGV[1];
shift(@ARGV);
shift(@ARGV);
} else {
last;
}
}
if (! -r $cf) {
die("$cf not readable; stopped");
}
eval(`cat $cf`) || die "eval of majordomo.cf failed $@";
# Go to the home directory specified by the .cf file
chdir("$homedir");
# All these should be in the standard PERL library
unshift(@INC, $homedir);
require "ctime.pl"; # To get MoY definitions for month abbrevs
require "majordomo_version.pl"; # What version of Majordomo is this?
require "majordomo.pl"; # all sorts of general-purpose Majordomo subs
require "shlock.pl"; # NNTP-style file locking
require "config_parse.pl"; # functions to parse the config files
# Here's where the fun begins...
$| = 1;
# check to see if the cf file is valid
die("listdir not defined. Is majordomo.cf being included correctly?")
if !defined($listdir);
# who do we send the body to if we step on a landmine?
&set_abort_addr($whoami_owner);
# who do sendmail messages appear to come from, by default?
&set_mail_from($whoami);
&set_mail_sender($whoami_owner);
if (defined($mailer)) { &set_mailer($mailer); }
# set our hostname (for use in log messages).
$hostname = &chop_nl(`hostname`);
# Announce a list; this is used to tell an initial list that it
# is open for business. All the current users get email telling
# them about the new list.
# announce list
sub do_announce {
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "announce";
local($list) = shift;
local($clean_list);
if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
&& defined($deflist)) {
unshift(@_,$list) ; # Not a list name, put it back.
$list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
$clean_list = &valid_list($listdir, $list);
}
if ($clean_list ne "") {
print "Announcing $clean_list..\n";
# The list is valid, parse the config file
&get_config($listdir, $clean_list) if !&cf_ck_bool($clean_list, '', 1);
local($list_addr) = "$list@$whereami";
# Set up the sendmail process to send mail to the list
&set_mail_sender($config_opts{$list,"sender"} . "@" . $whereami);
&sendmail(MSG, $list_addr, "Welcome to $list");
&set_mail_sender($whoami_owner);
print MSG "Welcome to the $list mailing list!\n";
if ( $majordomo_request ) {
print MSG <<"EOM";
If you ever want to remove yourself from this mailing list,
send the following command in email to
"${clean_list}-request@$whereami":
unsubscribe
Or you can send mail to "$whoami" with the following command
EOM
} else {
print MSG <<"EOM";
If you ever want to remove yourself from this mailing list,
you can send mail to "$whoami" with the following command
EOM
}
print MSG <<"EOM";
in the body of your email message:
unsubscribe $list $subscriber
Here's the general information for the list you are
subscribed to, in case you don't already have it:
EOM
# send them the info for the list, if it's available
if (&lopen(INFO, "", "$listdir/$list.info")) {
while (<INFO>) {
print MSG $_;
}
&lclose(INFO);
} else {
print MSG "#### No info available for $list.\n";
}
if (&valid_filename($filedir, $clean_list, $filedir_suffix, 'archive')) {
print MSG <<"EOM";
All messages sent to this list are being archived in a file called
"archive". To retreive the archive, send a messge with the command:
get $clean_list archive
to $whoami.
EOM
}
print MSG <<"EOM";
If you wish additional information on participating in this or other
mailing lists managed by Majordomo, please send a message containing
the command:
help
to $whoami.
EOM
# close (and thereby send) the announcement message to the list
close(MSG);
} else {
&squawk("$sm: unknown list '$list'.");
}
}
sub squawk {
print STDERR $_[0]."\n";
exit(1);
}
# each arg is a list to announce
while ($list = shift(@ARGV)) {
&do_announce($list);
}
print "Done.\n";
exit;
|
|