From ae6474326526bc8c398262157ecaaf4bf5009b1c Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 3 Apr 2021 13:01:29 -0700 Subject: [PATCH] Add function to remove spam prefix --- mailboxes/folders-lib.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mailboxes/folders-lib.pl b/mailboxes/folders-lib.pl index 090cae319..d483a8421 100755 --- a/mailboxes/folders-lib.pl +++ b/mailboxes/folders-lib.pl @@ -3799,4 +3799,19 @@ else { } } +# remove_spam_subject(&mail) +# Removes the [spam] prefix from the subject, if there is one +sub remove_spam_subject +{ +my ($mail) = @_; +my $rv = 0; +foreach my $h (@{$mail->{'headers'}}) { + if (lc($h->[0]) eq 'subject' && $h->[1] =~ /^\[spam\]\s*(.*)$/i) { + $h->[1] = $1; + $rv = 1; + } + } +return $rv; +} + 1;