Software Development writes:
> > Can someone please send me the help I need to get a "infobot" set up with
> > majordomo?
> Apparently the people at Hearts of Space do something like this:
[...]
> I don't know what they use for "auto-answer", though. You might try sending
> mail to info@hos.com and see what comes back and if that's the kind of
> thing you want.
Hearts of Space? That'd be me. I'm just using a hack that Brent
posted to this list a few months back.
Here's the code. I keep it in my regular majordomo directory.
> #!/usr/contrib/bin/perl
>
> # $Source: /mycroft/brent/majordomo/RCS/auto-answer,v $
> # $Revision: 1.1 $
> # $Date: 1993/12/18 07:49:14 $
> # $Author: brent $
> # $State: Exp $
> #
> # $Locker: brent $
>
> # 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);
> }
> if (! -r $cf) {
> die("$cf not readable; stopped");
> }
> eval(`cat $cf`);
>
> chdir($homedir) || die("Can't chdir(\"$homedir\"): $!");
> unshift(@INC, $homedir);
> require "majordomo.pl";
> require "getopts.pl";
>
> &Getopts("c:") || die("Getopts(): $!");
>
> &ParseMailHeader(STDIN, *hdrs);
> $reply_to = &RetMailAddr(*hdrs);
> $reply_to = join(", ", &ParseAddrs($reply_to));
> $in_reply_to = $hdrs{"message-id"} . ", from " . $hdrs{"from"};
> $user = shift(@ARGV);
>
> open(MAIL, "|/usr/sbin/sendmail -t -f$user-Owner") ||
> die("Can't connect to sendmail: $!");
>
> print MAIL <<"EOM";
> From: $user-Owner@$whereami
> To: $reply_to
> EOM
>
> if (defined($opt_c)) {
> print MAIL <<"EOM";
> Cc: $opt_c
> EOM
> }
>
> print MAIL <<"EOM";
> Subject: Your mail to $user@$whereami
> In-Reply-To: $in_reply_to
> Reply-To: $user-Owner@$whereami
> Sender: $user-Owner@$whereami
>
> This pre-recorded message is being sent in response to your recent
> email to $user@$whereami.
>
> EOM
>
> foreach $file (@ARGV) {
> open(FILE, $file) || die("open(FILE, \"$file\"): $!");
> while (<FILE>) {
> print MAIL $_;
> }
> print MAIL "\f\n";
> close(FILE);
> }
>
> close(MAIL);
>
> exit 0;
In /etc/aliases I have the following lines (split for clarity):
> # Hearts of Space Info server
> #
> info: "|/usr/lhc/majordomo/wrapper auto-answer -c info-owner Info \
> /usr/ftp/hos/info.hos"
> info-owner: info-own
I use info-own to collect daily statistics on how frequently the
info address gets hit. I use elm's filter, with the following
entry in filter-rules.
> if (from contains "info") then execute "grep '^To: ' >> \
> /home/info-own/info.log.%y%m%d"
This stuffs the e-mail address of the person making the request
into a file called, say, info.log.950215. We don't use the e-mail
addresses in any way, though someday I may do some analysis to
compare them with the subscribers to our weekly majordomo playlist
list to see how many people actually sign up as a result.
auto-answer is a great solution if you only want one infobot, one
returned file. I have another client with two of these addresses
working. Beyond that, I'd probably look into procmail.
Best, Eric
P.S. Check out the Hearts of Space gopher at hos.com. Web site on the
way ...
--
Eric S. Theise <verve@cyberwerks.com>, <verve@well.sf.ca.us>
Liberty Hill Cyberwerks, P.O. Box 460177, San Francisco, CA 94146
Internet Domain Editor, Millennium Whole Earth Catalog
The WELL: internet & news conference co-host + gophermeister
References:
|
|