This is a high indicator of spam (but out-of-scope for this
particular module) but sometimes it is not, and people
legitimately forget to set a Subject: header at all.
sub scrub {
my ($self, $mime) = @_;
my $subj = $mime->header('Subject');
- $subj =~ s/$self->{tag_re}/$1/; # $1 is "Re: "
- $mime->header_str_set('Subject', $subj);
+ if (defined $subj) {
+ $subj =~ s/$self->{tag_re}/$1/; # $1 is "Re: "
+ $mime->header_str_set('Subject', $subj);
+ }
$self->ACCEPT($mime);
}