#!/usr/local/bin/perl

# set our path explicitly
$ENV{'PATH'} = "/bin:/usr/bin:/usr/ucb";

# What shall we use for temporary files?
$tmp = "/tmp/majordomo.$$";

# Read and execute the .cf file
$cf = $ENV{"MAJORDOMO_CF"} || "/etc/majordomo.cf";
if ($ARGV[0] eq "-C") {
    $cf = $ARGV[1];
    shift(@ARGV); 
    shift(@ARGV); 
}
die("$cf not readable; stopped") unless -r $cf;
die("require of majordomo.cf failed") unless require $cf;

# 1.94 has this set in $CF already
$sendmail_command = "/usr/lib/sendmail" unless $sendmail_command;

chdir($homedir) || die("Can't chdir(\"$homedir\"): $!");
unshift(@INC, $homedir);
require "majordomo.pl";

&ParseMailHeader(STDIN, *hdrs);
$reply_to = &RetMailAddr(*hdrs);
$reply_to = join(", ", &ParseAddrs($reply_to));
$in_reply_to = $hdrs{"message-id"} . ", from " . $hdrs{"from"};
$list = $ARGV[0];

open(MAIL, "|-") || 
    &do_exec_sendmail(split(' ',
	   "$sendmail_command -f$whoami_owner -t"));

print MAIL <<"EOM";
To: $reply_to
From: Majordomo Owner <$whoami_owner>
Subject: Your mail to $list@$whereami
In-Reply-To: $in_reply_to
Reply-To: $whoami_owner

This pre-recorded message is being sent in response to your 
recent email to $list@$whereami.

The target list is not completely configured -- no list owner
has been defined. A list is not valid unless an owner is
available.

Your message is being returned unsent, but please hold on to
it. Once the list has been properly configured, it will be
"open for business"; you should resubmit your posting then.

If you were trying to subscribe to the list, please send 
your request to $whoami, not to 
$list@$whereami.

Here's your original, unsent message:

EOM

foreach ("From", "To", "Cc", "Subject", "Date", "Message-ID") {
    $tag = $_;
    tr/A-Z/a-z/;
    if (defined($hdrs{$_})) {
	print MAIL $tag, ": ", $hdrs{$_}, "\n";
    }
}

print MAIL "\n";

while (<STDIN>) {
    print MAIL $_;
}

close(MAIL);
exit 0;



syntax highlighted by Code2HTML, v. 0.9.1