At 11:15 AM 3/1/95 -0600, Software Development wrote:
>> Can someone please send me the help I need to get a "infobot" set up with
>> majordomo?
>>
>> By infobot I mean an address that can send back files per email request.
>> So for instance, if I send email to info@success.net that reads "send
>> about.txt" in the body, the mailer would send back that file.
>
Here's the one I use. It is a hack of Brent's 'request-answer' script.
You set up the the aliases something like this:
# Auto replies
suggestions:"|/usr/majordomo/wrapper file-reply -asuggestions -s'Thanks For
Your Suggestions' -f/usr/spool/majordomo/canned/suggestions",suggestion-team
suggestions-owner:Postmaster
It reads the majordomo.cf file and requires majordomo.pl so put it in with
the majordomo files.
Here is the script. Works here, let me know about incompatibilities. No
promises! :-)
-----------------------------------------------------------------------
#!/usr/lbin/perl
# file-reply
# When mail is sent to an address, reply with the contents of a file
# usage:
# wrapper file-reply -C /alternate/config/file -a sender_address -s subject
-f file
#
# Should be set to the same permissions as majordomo. resend, etc.
# sender_address should equal the mail alias
#
#
# set our path explicitly
$ENV{'PATH'} = "/bin:/usr/bin:/usr/ucb";
require "getopts.pl";
&Getopts("C:a:s:f:") || die("resend: Getopts(): $!");
# 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);
}
if (! -r $cf) {
die("$cf not readable; stopped");
}
eval(`cat $cf`);
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"};
if(defined($opt_s)){
$subject = $opt_s;
} elsif((defined($opt_a)) && (!defined($opt_s))) {
$subject = "Your mail to $opt_a";
} else {
$subject = "In Reply to Your Mail";
}
$file = $opt_f;
if(defined($opt_a)){
$sender = "$opt_a-owner@$whereami";
} else {
$sender = "info-owner@$whereami";
}
eval "\$mail_prog = \"$mailer\"";
print "mailer: $mail_prog\n";
open(MAIL, "|$mail_prog") ||
die("Can't connect to mailer: $!");
# Create the headers
print MAIL <<"EOM";
From: $sender
To: $reply_to
Subject: $subject
In-Reply-To: $in_reply_to
Reply-To: $sender
EOM
#Dump the file into the mail pipe.
if(defined($opt_f)){
open(FILE, "$file") || print MAIL "No file found\n";
while(<FILE>){print MAIL $_;}
close(FILE);
} else {
print MAIL "No reply file specified in command line\n";
}
close(MAIL);
exit 0;
//////////////////////////////////////////////////////////////////////////////
Doug Plate Sr. <plate@dicomed.com>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|