File Coverage

blib/lib/Mail/Qmail/Filter/LogEnvelope.pm
Criterion Covered Total %
statement 8 13 61.5
branch 0 2 0.0
condition 0 5 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 12 25 48.0


line stmt bran cond sub pod time code
1 1     1   1245 use 5.014;
  1         3  
2 1     1   6 use warnings;
  1         1  
  1         49  
3              
4             package Mail::Qmail::Filter::LogEnvelope;
5              
6             our $VERSION = '1.0';
7              
8 1     1   5 use Mo qw(coerce);
  1         2  
  1         5  
9             extends 'Mail::Qmail::Filter';
10              
11             sub filter {
12 0     0 1   my $self = shift;
13              
14             $self->debug(
15             RELAYCLIENT => ( defined $ENV{TCPREMOTEHOST} && "$ENV{TCPREMOTEHOST} " )
16             . "[$ENV{TCPREMOTEIP}]" )
17 0 0 0       if exists $ENV{RELAYCLIENT};
18 0           my $message = $self->message;
19 0   0       $self->debug( 'RFC5321.MailFrom' => $message->from || '<>' );
20 0           $self->debug( to => join ', ', $message->to );
21             }
22              
23             1;
24              
25             __END__
26              
27             =head1 NAME
28              
29             Mail::Qmail::Filter::LogEnvelope -
30             log envelope data
31              
32             =head1 SYNOPSIS
33              
34             use Mail::Qmail::Filter;
35              
36             Mail::Qmail::Filter->new->add_filter(
37             '::LogEnvelope',
38             )->run;
39              
40             =head1 DESCRIPTION
41              
42             This L<Mail::Qmail::Filter> plugin logs the following items:
43              
44             =over 4
45              
46             =item RELAYCLIENT
47              
48             only if the environmental variable C<RELAYCLIENT> is set:
49             information about C<TCPREMOTEHOST> and C<TCPREMOTEIP>
50              
51             =item RFC5232.MailFrom
52              
53             the envelope sender
54              
55             =item to
56              
57             the recipients of the message
58              
59             =back
60              
61             =head1 SEE ALSO
62              
63             L<Mail::Qmail::Filter/COMMON PARAMETERS FOR ALL FILTERS>
64              
65             =head1 LICENSE AND COPYRIGHT
66              
67             Copyright 2019 Martin Sluka.
68              
69             This module is free software; you can redistribute it and/or modify it
70             under the terms of the the Artistic License (2.0). You may obtain a
71             copy of the full license at:
72              
73             L<http://www.perlfoundation.org/artistic_license_2_0>
74              
75             Any use, modification, and distribution of the Standard or Modified
76             Versions is governed by this Artistic License. By using, modifying or
77             distributing the Package, you accept this license. Do not use, modify,
78             or distribute the Package, if you do not accept this license.
79              
80             If your Modified Version has been derived from a Modified Version made
81             by someone other than you, you are nevertheless required to ensure that
82             your Modified Version complies with the requirements of this license.
83              
84             This license does not grant you the right to use any trademark, service
85             mark, tradename, or logo of the Copyright Holder.
86              
87             This license includes the non-exclusive, worldwide, free-of-charge
88             patent license to make, have made, use, offer to sell, sell, import and
89             otherwise transfer the Package with respect to any patent claims
90             licensable by the Copyright Holder that are necessarily infringed by the
91             Package. If you institute patent litigation (including a cross-claim or
92             counterclaim) against any party alleging that the Package constitutes
93             direct or contributory patent infringement, then this Artistic License
94             to you shall terminate on the date that such litigation is filed.
95              
96             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
97             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
98             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
99             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
100             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
101             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
102             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
103             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104              
105             =cut