Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Mail::Action
base for building modules that act on incoming mail

Mail::Action - base for building modules that act on incoming mail


NAME

Mail::Action - base for building modules that act on incoming mail


SYNOPSIS


        use base 'Mail::Action';


DESCRIPTION

E-mail doesn't have to be boring. If you have server-side filters, a bit of disk space, some cleverness, and access to an outgoing SMTP server, you can do some very clever things. Want a temporary mailing list? Try the Mail::SimpleList manpage. Want a temporary, mostly-anonymous mailing address? Try the Mail::TempAddress manpage. Want to build your own similar program? Read on.

Mail::Action, Mail::Action::Address, Mail::Action::Request, and Mail::Action::Storage make it easy to create a other modules that receive, filter, and respond to incoming e-mails.


METHODS

  • new( $address_directory, [ Filehandle => $fh, Storage => $storage, Request => $request ] )
  • new() takes one mandatory argument and three optional arguments. $address_directory is the path to the directory where address data is stored. You can usually get by with just the mandatory argument.

    $fh is a filehandle (or a reference to a glob) from which to read an incoming message. If not provided, M::TA will read from STDIN, as that is how mail filters work.

    $storage should be a the Mail::Action::Storage manpage object (or workalike), which manages the storage of action data. If not provided, Mail::Action will use the Mail::Action::Storage manpage by default.

    $request should be a Mail::Action::Request object (representing and encapsulating an incoming e-mail message) to the constructor. If not provided, M::TA will use the Mail::Action::Request manpage by default.

  • process()
  • Processes one incoming message.

  • find_command()
  • Looks in the Subject header of the incoming message for a command (a word contained within asterisks, such as *help*. If it finds this, it checks to see if the current object can perform a method named command_command, where command is the command found. If so, it returns the name of that method.

    If not, it returns an empty string.

  • copy_headers()
  • Copies, cleans, and returns a hash reference of headers from the incoming message.

  • command_help( $pod, @headings )
  • Given $pod, POD documentation, and @headings, and list of headings within the POD, extracts the POD within those headings, turns it into plain text, and e-mails that text to the From address of the incoming message.

  • process_body( $address )
  • Looks for lines of the form:
    
            Directive: arguments

    at the start of the body of the incoming message. If the $address object (likely the Mail::Action::Address manpage or equivalent) understands the directive, this method calls the method with the name of the directive on the address object, passing the arguments.

    This stops looking for directives when it encounters a blank line.

  • reply( $headers, @body )
  • Given a hash reference of e-mail $headers and a list of lines of @body text, sends a message via the Mail::Mailer manpage. Be sure you've configured that correctly.


SUBCLASSING

In addition to the methods described earlier, you may want to override any of the other methods:

fetch_address()
Attempts to retrieve the address for the associated alias, if it exists. In scalar context, returns just the address. In list context, returns the address and the alias. If the address does not exist, returns nothing.

message()
Returns the Email::MIME object associated with this request.

request()
Returns the request object for this object.

storage()
Returns the storage object for this object.


SEE ALSO

the Mail::SimpleList manpage and the Mail::TempAddress manpage for example uses.

See the Mail::Action::Address manpage, the Mail::Action::Request manpage, the Mail::Action::Storage manpage, and the Mail::Action::PodToHelp manpage for related modules.


AUTHOR

chromatic, <chromatic at wgz dot org<.


BUGS

No known bugs.


COPYRIGHT

Copyright (c) 2003 - 2005, chromatic. All rights reserved. You may use, modify, and distribute this module under the same terms as Perl 5.8.x itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy