From e33450467194f02720a9432642cbdd2a7532f662 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 30 Sep 2025 16:01:56 +0100 Subject: [PATCH 1/2] [tests] Add 'Auto-Submitted' header testcases --- t/mail/autogenerated.t | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/mail/autogenerated.t b/t/mail/autogenerated.t index a37c9b12dc2..bce3d039c0f 100644 --- a/t/mail/autogenerated.t +++ b/t/mail/autogenerated.t @@ -19,4 +19,13 @@ ok RT::Interface::Email::CheckForAutoGenerated($msg->head), "Is AutoGenerated"; $msg->head->delete("Precedence", 1); ok !RT::Interface::Email::CheckForAutoGenerated($msg->head), "Isn't AutoGenerated"; +$msg->head->set("Auto-Submitted", 'yes'); +ok RT::Interface::Email::CheckForAutoGenerated($msg->head), "Is AutoGenerated"; + +$msg->head->set("Auto-Submitted", 'no'); +ok !RT::Interface::Email::CheckForAutoGenerated($msg->head), "Isn't AutoGenerated, as 'no'"; + +$msg->head->delete("Auto-Submitted"); +ok !RT::Interface::Email::CheckForAutoGenerated($msg->head), "Isn't AutoGenerated, no header"; + done_testing; From 9dbf3759e0f95c59b94474c619b77222a41339ff Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 23 Sep 2025 15:47:15 +0100 Subject: [PATCH 2/2] Fix handling of 'Auto-Submitted' header in email processing Previously if the 'Auto-Submitted' mail header was set the email was always assumed to be auto-generated, even if the header was set with the 'no' value. This fix makes the line after check that no case proprely --- lib/RT/Interface/Email.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index 7c0b3b04ecd..34823e0515c 100644 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -590,6 +590,8 @@ sub CheckForAutoGenerated { # Per RFC3834, any Auto-Submitted header which is not "no" means # it is auto-generated. my $AutoSubmitted = $head->get("Auto-Submitted") || ""; + chomp $AutoSubmitted; + $AutoSubmitted =~ s/^\s+|\s+$//g; return 1 if length $AutoSubmitted and $AutoSubmitted ne "no"; # First Class mailer uses this as a clue.