Modify ↓
Opened 7 weeks ago
#13770 assigned defect
`Reply-To: <>` header generated when [notification] smtp_replyto is empty
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.1 |
Component: | notification | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The Reply-To
should be omitted when [notification] smtp_replyto
is empty.
Content-Type: multipart/related; boundary="===============7984323936476389257==" MIME-Version: 1.0 X-Mailer: Trac 1.6.1.dev0, by Edgewall Software X-Trac-Version: 1.6.1.dev0 X-Trac-Project: My Project X-URL: X-Trac-Realm: test Precedence: bulk Auto-Submitted: auto-generated Message-ID: <073.33b09254542a2586acff57f1bbef6f10@example.org> Date: Fri, 19 Jul 2024 03:10:05 -0000 To: undisclosed-recipients: ; From: My Project <trac@example.org> Cc: cc@example.org Reply-To: <> --===============7984323936476389257== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit blah --===============7984323936476389257==--
Patch:
-
trac/notification/mail.py
diff --git a/trac/notification/mail.py b/trac/notification/mail.py index 4c008f3de..95a276839 100644
a b class EmailDistributor(Component): 646 646 set_header(message, 'Cc', addresses=cc_addrs) 647 647 if bcc_addrs: 648 648 set_header(message, 'Bcc', addresses=bcc_addrs) 649 set_header(message, 'Reply-To', addresses=[smtp_replyto]) 649 if smtp_replyto: 650 set_header(message, 'Reply-To', addresses=[smtp_replyto]) 650 651 651 652 for decorator in self.decorators: 652 653 decorator.decorate_message(event, message, self._charset) -
trac/notification/tests/mail.py
diff --git a/trac/notification/tests/mail.py b/trac/notification/tests/mail.py index 23e8a6289..7569605a7 100644
a b class EmailDistributorTestCase(unittest.TestCase): 509 509 self._assert_equal_sets(['cc@example.org'], 510 510 self._cclist(message['Cc'])) 511 511 512 def test_replyto(self): 513 config = self.env.config 514 config.set('notification', 'smtp_replyto', 'replyto@example.org') 515 self._notify_event('blah') 516 history = self.sender.history 517 from_addr, recipients, message = history[0] 518 self.assertEqual('replyto@example.org', message['Reply-To']) 519 520 def test_replyto_empty(self): 521 config = self.env.config 522 config.set('notification', 'smtp_replyto', '') 523 self._notify_event('blah') 524 history = self.sender.history 525 from_addr, recipients, message = history[0] 526 self.assertNotIn('Reply-To', message) 527 512 528 513 529 class RecipientMatcherTestCase(unittest.TestCase): 514 530
Attachments (0)
Note:
See TracTickets
for help on using tickets.