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