Mail/Qmail/Filter/RewriteSender.pm

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