Skip to content

Commit 8a626db

Browse files
committed
Handle auto-submitted header on inbound email like bulk.
Part of issue2550564.
1 parent eb2caa9 commit 8a626db

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Fixed:
2020
[A-z][A-z0-9_]+[A-z_]. This was never documented or enforced, but
2121
we get obscure errors if the rules are not followed. (Tom
2222
Ekberg tests by John Rouilard)
23+
- issue2550564 - Roundup sets "Precedence: bulk" on all outgoing mail,
24+
which seems wrong. Handle Auto-Submitted header on *inbound* email
25+
like we do precedence bulk. This is part of this issue.
2326

2427
2020-07-13 2.0.0
2528

roundup/mailgw.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,18 @@ def handle_ignore(self):
535535
''' Check to see if message can be safely ignored:
536536
detect loops and
537537
Precedence: Bulk, or Microsoft Outlook autoreplies
538+
Auto-Submitted not equal to no, so auto-generated,
539+
auto-replied and auto-notified are dropped. rstrip
540+
auto-submitted value because trailing comment/whitespace
541+
is allowed per RFC3834. Note that we only handle whitespace.
542+
Lowercase the value as references say No and no as possible
543+
values.
538544
'''
539545
if self.message.get_header('x-roundup-loop', ''):
540546
raise IgnoreLoop
541547
if (self.message.get_header('precedence', '') == 'bulk'
548+
or self.message.get_header('auto-submitted', 'no').rstrip().lower() \
549+
!= 'no'
542550
or self.subject.lower().find("autoreply") > 0):
543551
raise IgnoreBulk
544552

test/test_mailgw.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,6 +3590,37 @@ def testItsBulkStupid(self):
35903590
Hi, I'm on holidays, and this is a dumb auto-responder.
35913591
''')
35923592

3593+
def testItsAutoSubmittedStupid(self):
3594+
self.assertRaises(IgnoreBulk, self._handle_mail,
3595+
'''Content-Type: text/plain;
3596+
charset="iso-8859-1"
3597+
From: Chef <[email protected]>
3598+
Auto-Submitted: Auto-Generated
3599+
3600+
3601+
Message-Id: <dummy_test_message_id>
3602+
Subject: Re: [issue] Testing...
3603+
3604+
Hi, I'm on holidays, and this is a dumb auto-responder.
3605+
''')
3606+
3607+
def testItsHumanSubmitted(self):
3608+
''' keep trailing spaces on Auto-submitted header
3609+
'''
3610+
self.db.keyword.create(name='Foo')
3611+
self._handle_mail('''Content-Type: text/plain;
3612+
charset="iso-8859-1"
3613+
From: richard <[email protected]>
3614+
3615+
Message-Id: <followup_dummy_id>
3616+
In-Reply-To: <dummy_test_message_id>
3617+
Auto-submitted: No
3618+
Subject: [keyword1] Testing... [name=Bar]
3619+
3620+
''')
3621+
self.assertEqual(self.db.keyword.get('1', 'name'), 'Bar')
3622+
3623+
35933624
def testAutoReplyEmailsAreIgnored(self):
35943625
self.assertRaises(IgnoreBulk, self._handle_mail,
35953626
'''Content-Type: text/plain;

0 commit comments

Comments
 (0)