Email::AutoReply - Perl extension for writing email autoresponders
use Email::AutoReply; my $auto = Email::AutoReply->new; $auto->reply;
This module may be useful in writing autoresponders. The example code above will try to respond (using Sendmail) to an email message given as standard input.
The module will reply once to each email address it sees, storing sent-to addresses in a database. This database class is Email::AutoReply::DB::BerkeleyDB by default, but any class that implements Email::AutoReply::DB may be used.
All attributes are set and get using code similar to the following:
$auto = new Email::AutoReply; # get debug status $dbg = $auto->debug; # set debug status to "on" $auto->debug(1);
Set/get the class to use for the cache DB.
Set/get weather debugging is enabled. 0 means off, 1 means on.
Set/get autoreply 'From' email for the autoreply. Example: 'email@example.com'.
Set/get autoreply 'From' name for the autoreply. Example: 'Adam Monsen'. Note: this will be ignored unless from_email is also set.
Set/get the hostname where this package will be executed. This is used when constructing an X-Mail-AutoReply header for the autoreply.
Set/get the full text of the email to parse and reply to.
Set/get the string which will serve as the body of the autoreply.
Default: 'Sorry, the person you're trying to reach is unavailable. This is an automated response from Email::AutoReply. See http://search.cpan.org/perldoc?Email::AutoReply for more info.'
Set/get the directory to in which to store Email::AutoReply settings.
Set/get the Email::Send class used to send the autoreply.
Set/get extra arguments passed to Email::Send::send(). By default, this is '"-f $bot_from"', and this string is eval()'d. Quotes are significant! This is double quotes inside of single quotes. $bot_from will expand to be either from_email, or the name specfied in the To: field of the original email (if from_email is unset). '"-f $bot_from"' is sendmail-specific, by the way, and basically tells Sendmail to set the envelope sender to something different than the default. See sendmail(8) for more details.
Default: '"-f $bot_from"'
Set/get the subject to be used in the autoreply.
Default: 'Out Of Office Automated Response'
Takes any attributes as arguments, or none:
# set the debug and response_text attributes my $auto = Email::AutoReply->new( debug => 1, response_text => "I'm on vacation, ttyl." ); # no arguments my $auto = Email::AutoReply->new;
Returns a new Email::AutoReply object.
Takes no arguments.
Returns a list of emails in the "already sent to" database.
Takes no arguments. If the 'input_email' attribute is set, this class will read that as the email to (possibly) autoreply to. If the 'input_email' attribute is not set, an email message will be extracted from standard input.
No return value.
Adam Monsen, <firstname.lastname@example.org>
To report bugs or enter feature requests, go to
or send mail to <bug-Email-AutoReply@rt.cpan.org>
Copyright (C) 2004-2008 by Adam Monsen
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.