Please visit our sponsor
UNKNOWN
=**************************************
= Name: Autoresponder
= Description:A script for receiving a mail and immediately replying
= By: Found on the World Wide Web
=
=
= Inputs:None
=
= Returns:None
=
=Assumes:None
=
=Side Effects:None
=**************************************
#!/usr/bin/perl
=pod
=head1 NAME
autoresponder - A scrtipt for receiving a mail and immediately replying.
=head1 SYNOPSIS
autoresponder [options] [filename]
=head1 DESCRIPTION
While installing a new mail server or client you typically are sending
and receiving test mails over and over again. Even worse, you sometimes
have to do a phonecall and ask someone for sending a mail to you.
This script will help you in some cases by setting up an email address
like autoresponder@company.com that will receive email addresses and
immediately reply it back.
=head1 INSTALLATION
Install the prerequisite Perl modules, in particular Graham Barr's
excellent Mailtools package. L.
In /etc/mail/aliases or /etc/aliases, put lines like this:
autoresponder: "| /usr/local/bin/autoresponder"
owner-autoresponder: /dev/null
autoresponder-owner: /dev/null
Then do a "newaliases".
Edit the autoresponder script and change the reply-to address to
point back to one of the owner addresses. This should have the
advantage that you won't see error messages generated by the
autoresponder.
=head1 SCRIPT CATEGORIES
mailstuff
=head1 PREREQUISITES
The MailTools package, in particular the Mail::Internet module.
L.
=head1 OSNAMES
any OS using sendmail or a compatible mail server
=head1 AUTHOR
Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Email: joe@ispsoft.de
=head1 SEE ALSO
L, L
=cut
use strict;
############################################################################
#
#Configurable section
#
############################################################################
my $REPLY_TO = 'autoresponder-owner@neckar-alb.de';
#
#Use an entry like
#
# autoresponder-owner: /dev/null
#
#to suppress error messages from autoresponders replies.
#
############################################################################
use Mail::Internet ();
use Getopt::Long ();
use vars qw($opt_debug $opt_verbose $opt_help);
sub Usage() {
print <new($fh, 'Modify' => 0, 'MailFrom' => 'KEEP');
my @headers = @{$msg->head()->header()};
my @body = @{$msg->body()};
my @message = ("\n",
"Your mail was received by the autoresponder.\n",
"\n",
"Your headers have been:\n",
@headers,
"End of headers\n",
"\n",
"Your body follows:\n",
@body
);
$msg = $msg->reply();
$msg->body(\@message);
print("Replying to $REPLY_TO.\n") if $opt_verbose;
$msg->head()->replace('Reply-To', $REPLY_TO);
print("Replying message:\n", $msg->as_string()) if $opt_verbose;
$msg->smtpsend() unless $opt_debug;