1 # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
8 # drop plus addressing for matching
11 $str_addr =~ s/\+.*\@/\@/;
15 # do not allow Bcc, only Cc and To if ORIGINAL_RECIPIENT (postfix) env is set
16 sub recipient_specified {
17 my ($klass, $filter) = @_;
18 my $or = $ENV{ORIGINAL_RECIPIENT};
19 defined($or) or return 1; # for imports
20 my @or = Email::Address->parse($or);
21 my $oaddr = __drop_plus($or[0]->address);
22 $oaddr = qr/\b\Q$oaddr\E\b/i;
23 my @to = Email::Address->parse($filter->to);
24 my @cc = Email::Address->parse($filter->cc);
25 foreach my $addr (@to, @cc) {
26 if (__drop_plus($addr->address) =~ $oaddr) {