File Coverage

blib/lib/Mail/Qmail/Filter/RewriteSender.pm
Criterion Covered Total %
statement 8 12 66.6
branch n/a
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 12 17 70.5


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