# Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
# Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
use Email::Address;
use Date::Parse qw(strptime);
use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
use Email::Address;
use Date::Parse qw(strptime);
use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
# do not allow Bcc, only Cc and To if recipient is set
sub precheck {
my ($klass, $filter, $address) = @_;
# do not allow Bcc, only Cc and To if recipient is set
sub precheck {
my ($klass, $filter, $address) = @_;
return 0 unless usable_str(length('<m@h>'), $mid) && $mid =~ /\@/;
return 0 unless usable_str(length('u@h'), $filter->from);
return 0 unless usable_str(length(':o'), $simple->header("Subject"));
return 0 unless usable_str(length('<m@h>'), $mid) && $mid =~ /\@/;
return 0 unless usable_str(length('u@h'), $filter->from);
return 0 unless usable_str(length(':o'), $simple->header("Subject"));