1Mail::Filter(3) User Contributed Perl Documentation Mail::Filter(3)
2
3
4
6 Mail::Filter - Filter mail through multiple subroutines
7
9 use Mail::Filter;
10
11 my $filter = Mail::Filter->new( \&filter1, \&filter2 );
12
13 my $mail = Mail::Internet->new( [<>] );
14 my $mail = $filter->filter($mail);
15
16 my $folder = Mail::Folder->new( .... );
17 my $filter->filter($folder);
18
20 "Mail::Filter" provides an interface to filtering Email through
21 multiple subroutines.
22
23 "Mail::Filter" filters mail by calling each filter subroutine in turn.
24 Each filter subroutine is called with two arguments, the first is the
25 filter object and the second is the mail or folder object being
26 filtered.
27
28 The result from each filter sub is passed to the next filter as the
29 mail object. If a filter subroutine returns undef, then "Mail::Filter"
30 will abort and return immediately.
31
32 The function returns the result from the last subroutine to operate on
33 the mail object.
34
36 Constructors
37 Mail::Filter->new([FILTER [, ... ]])
38
39 Create a new "Mail::Filter" object with the given filter
40 subroutines. Each filter may be either a code reference or the name
41 of a method to call on the <Mail::Filter> object.
42
43 Accessors
44 $obj->add(FILTER [, FILTER ...])
45
46 Add the given filters to the end of the fliter list.
47
48 Processing
49 $obj->filter(MAIL-OBJECT | MAIL-FOLDER)
50
51 If the first argument is a "Mail::Internet" object, then this
52 object will be passed through the filter list. If the first
53 argument is a "Mail::Folder" object, then each message in turn will
54 be passed through the filter list.
55
56 $obj->folder
57
58 While the "filter" method is called with a "Mail::Folder" object,
59 these filter subroutines can call this method to obtain the folder
60 object that is being processed.
61
62 $obj->msgnum
63
64 If the "filter" method is called with a "Mail::Folder" object, then
65 the filter subroutines may call this method to obtain the message
66 number of the message that is being processed.
67
69 This module is part of the MailTools distribution,
70 http://perl.overmeer.net/mailtools/.
71
73 The MailTools bundle was developed by Graham Barr. Later, Mark
74 Overmeer took over maintenance without commitment to further
75 development.
76
77 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
78 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
79 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
80
82 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
83 Overmeer <perl@overmeer.net>.
84
85 This program is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself. See
87 http://www.perl.com/perl/misc/Artistic.html
88
89
90
91perl v5.12.2 2010-10-01 Mail::Filter(3)