diff options
author | dakkar <dakkar@thenautilus.net> | 2023-02-28 13:02:47 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2023-02-28 13:02:47 +0000 |
commit | cf5c62b19dd36ad9d433c8b88ed78e3ab965776d (patch) | |
tree | b5465683cf0040ea9aabb0b56ff14c0da09f13d9 /lib/Sietima/Role/NoSpoof.pm | |
parent | v1.1.1 (diff) | |
parent | Dzil-build release 1.1.0 (from dd7c2c5 on master) (diff) | |
download | Sietima-cf5c62b19dd36ad9d433c8b88ed78e3ab965776d.tar.gz Sietima-cf5c62b19dd36ad9d433c8b88ed78e3ab965776d.tar.bz2 Sietima-cf5c62b19dd36ad9d433c8b88ed78e3ab965776d.zip |
Dzil-build release 1.1.1 (from 8a400b7 on master)v1.1.1
Diffstat (limited to 'lib/Sietima/Role/NoSpoof.pm')
-rw-r--r-- | lib/Sietima/Role/NoSpoof.pm | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/lib/Sietima/Role/NoSpoof.pm b/lib/Sietima/Role/NoSpoof.pm index ba703cb..88efdc7 100644 --- a/lib/Sietima/Role/NoSpoof.pm +++ b/lib/Sietima/Role/NoSpoof.pm @@ -4,9 +4,41 @@ use Sietima::Policy; use Email::Address; use namespace::clean; -# VERSION +our $VERSION = '1.1.1'; # VERSION # ABSTRACT: never sends out messages from subscribers' addresses + +with 'Sietima::Role::WithPostAddress'; + +around munge_mail => sub ($orig,$self,$incoming_mail) { + my $sender = $self->post_address->address; + my ($from) = Email::Address->parse($incoming_mail->header_str('From')); + + $from->address($sender); + + $incoming_mail->header_str_set( + From => $from, + ); + + return $self->$orig($incoming_mail); +}; + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Sietima::Role::NoSpoof - never sends out messages from subscribers' addresses + +=head1 VERSION + +version 1.1.1 + =head1 SYNOPSIS my $sietima = Sietima->with_traits('NoSpoof')->new(\%args); @@ -21,21 +53,15 @@ C<post_address>|Sietima::Role::WithPostAddress >> (this is a This will make the list DMARC-compliant. -=cut +=head1 AUTHOR -with 'Sietima::Role::WithPostAddress'; +Gianni Ceccarelli <dakkar@thenautilus.net> -around munge_mail => sub ($orig,$self,$incoming_mail) { - my $sender = $self->post_address->address; - my ($from) = Email::Address->parse($incoming_mail->header_str('From')); +=head1 COPYRIGHT AND LICENSE - $from->address($sender); +This software is copyright (c) 2023 by Gianni Ceccarelli <dakkar@thenautilus.net>. - $incoming_mail->header_str_set( - From => $from, - ); +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. - return $self->$orig($incoming_mail); -}; - -1; +=cut |