The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Email::AutoReply - Perl extension for writing email autoresponders

SYNOPSIS

  use Email::AutoReply;
  my $auto = Email::AutoReply->new;
  $auto->reply;

DESCRIPTION

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.

ATTRIBUTES

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);
cachedb_type

Set/get the class to use for the cache DB.

Default: 'Email::AutoReply::DB::BerkeleyDB'

debug

Set/get weather debugging is enabled. 0 means off, 1 means on.

Default: 0

from_email

Set/get autoreply 'From' email for the autoreply. Example: 'adam@example.com'.

from_realname

Set/get autoreply 'From' name for the autoreply. Example: 'Adam Monsen'. Note: this will be ignored unless from_email is also set.

Default: undef

hostname

Set/get the hostname where this package will be executed. This is used when constructing an X-Mail-AutoReply header for the autoreply.

Default: 'localhost'

input_email

Set/get the full text of the email to parse and reply to.

Default: undef

response_text

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.'

settings_dir

Set/get the directory to in which to store Email::AutoReply settings.

Default: /home/$ENV{HOME}/.email-autoreply

send_method

Set/get the Email::Send class used to send the autoreply.

Default: 'Sendmail'

send_method_args

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"'

subject

Set/get the subject to be used in the autoreply.

Default: 'Out Of Office Automated Response'

METHODS

new

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.

dbdump

Takes no arguments.

Returns a list of emails in the "already sent to" database.

reply

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.

AUTHOR

Adam Monsen, <haircut@gmail.com>

BUGS

To report bugs or enter feature requests, go to

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Email-AutoReply

or send mail to <bug-Email-AutoReply@rt.cpan.org>

SEE ALSO

Email::Send, Mail::Vacation

COPYRIGHT AND LICENSE

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.

See http://www.perl.com/perl/misc/Artistic.html