blob: f01dadf97cfe96cde62974f65896515d3084bc9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package Sietima::Role::SubscriberOnly; use Moo::Role; use Sietima::Policy; use Email::Address; use List::AllUtils qw(any); use namespace::clean; requires 'munge_mail_from_non_subscriber'; our $let_it_pass=0; around munge_mail => sub ($orig,$self,$mail) { my ($from) = Email::Address->parse( $mail->header_str('from') ); if ( $let_it_pass or any { $_->match($from) } $self->subscribers->@* ) { $self->$orig($mail); } else { $self->munge_mail_from_non_subscriber($mail); } }; 1;
|