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(@filters)
38 Create a new "Mail::Filter" object with the given filter
39 subroutines. Each filter may be either a code reference or the name
40 of a method to call on the <Mail::Filter> object.
41
42 Accessors
43 $obj->add(@filters)
44 Add the given @filters to the end of the filter list.
45
46 Processing
47 $obj->filter($mail|$folder)
48 If the first argument is a Mail::Internet object, then this object
49 will be passed through the filter list. If the first argument is a
50 Mail::Folder object, then each message in turn will be passed
51 through the filter list.
52
53 $obj->folder()
54 While the filter() method is called with a Mail::Folder object,
55 these filter subroutines can call this method to obtain the folder
56 object that is being processed.
57
58 $obj->msgnum()
59 If the filter() method is called with a Mail::Folder object, then
60 the filter subroutines may call this method to obtain the message
61 number of the message that is being processed.
62
64 This module is part of the MailTools distribution,
65 http://perl.overmeer.net/mailtools/.
66
68 The MailTools bundle was developed by Graham Barr. Later, Mark
69 Overmeer took over maintenance without commitment to further
70 development.
71
72 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
73 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
74 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
75
77 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark
78 Overmeer <perl@overmeer.net>.
79
80 This program is free software; you can redistribute it and/or modify it
81 under the same terms as Perl itself. See
82 http://www.perl.com/perl/misc/Artistic.html
83
84
85
86perl v5.34.0 2021-07-22 Mail::Filter(3)