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