Commit 16985122 authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Merge 4.2/multiple-precedence into 4.2-trunk

parents a9407e7f 793ed75c
...@@ -161,17 +161,16 @@ sub CheckForSuspiciousSender { ...@@ -161,17 +161,16 @@ sub CheckForSuspiciousSender {
=head2 CheckForAutoGenerated HEAD =head2 CheckForAutoGenerated HEAD
Takes a HEAD object of L<MIME::Head> class and returns true if message Takes a HEAD object of L<MIME::Head> class and returns true if message is
is autogenerated. Checks 'Precedence' and 'X-FC-Machinegenerated' autogenerated. Checks C<Precedence>, C<Auto-Submitted>, and
fields of the head in tests. C<X-FC-Machinegenerated> fields of the head in tests.
=cut =cut
sub CheckForAutoGenerated { sub CheckForAutoGenerated {
my $head = shift; my $head = shift;
my $Precedence = $head->get("Precedence") || ""; if (grep { /^(bulk|junk)/i } $head->get_all("Precedence")) {
if ( $Precedence =~ /^(bulk|junk)/i ) {
return (1); return (1);
} }
......
use strict;
use warnings;
use RT::Test tests => undef;
use Email::Abstract;
my $msg = Email::Abstract->new(<<'MSG')->cast("MIME::Entity");
From: somebody@example.com
To: rt@example.com
Precedence: never-bounce
Precedence: bulk
Subject: testing precedence
I am bulk mail, hear me roar!
MSG
ok RT::Interface::Email::CheckForAutoGenerated($msg->head), "Is AutoGenerated";
$msg->head->delete("Precedence", 1);
ok !RT::Interface::Email::CheckForAutoGenerated($msg->head), "Isn't AutoGenerated";
done_testing;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment