View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Pavel Boldin > Mail-Lite-0.1005 > Mail::Lite::Mbox



Annotate this POD

View/Report Bugs


Mail::Lite::Mbox::Processor - Framework for automated mail processing


  use Mail::Lite::Mbox::Processor;

  my $matcher1 = new Mail::Lite::Message::Matcher('rules.yaml');
  my $handler_name = $matcher1->process_message( $message );

  my $processor = new MyMessageProcessor;
  my $matcher2 = new Mail::Lite::Message::Matcher('rules.yaml', $processor);
  my $result = $matcher2->process_message( $message );


Mail::Lite::Message::Matcher is a framework for automated mail processing. For example you have a mail server and you have a need to process some types of incoming mail messages automatically. For example, you can extract automated notifications, invoices, alerts etc. from your mail flow and perform some tasks based on content of those messages.

To use this module you have to provide the following:

configuration file with list of rules
Perl code for each rule


An object of this class represents specific message processor, that can process mail messages one-by-one.


This constructor creates new Mail::Lite::Message::Matcher object. CONFIG_FILE - string with path to configuration file. PROCESSOR - instance of processor object.

process_message( MESSAGE )

MESSAGE is either plain text rfc822 mesage or already initialized Mail::Lite::Message::Parser object representing message. This method finds rule that matches the message and tries to process message (if message processor is specified).

I.e. if PROCESSOR object is specified (if it was passed to the constructor), messages will be automatically processed by calling appropriate methods of this processor object. If PROCESSOR is not specified, just appropriate rule will be returned as a result. In the latter case you have to process message yourself using handler name and message type id from the rule.


Depends on:

 <Mail::Lite::Message::Parser> (used as a backend for parsing messages)

 <YAML::Tiny> (used to parser configuraion file)


Walery Studennikov, <despair [at] cpan [dot] org>


Copyright (C) 2007 by Walery Studennikov

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.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: