Skip to content

Commit

Permalink
1.6.1dev: fix incorrect Reply-To: <> header generated in notificati…
Browse files Browse the repository at this point in the history
…on mail when `smtp_replyto` not configured (closes #13770)

git-svn-id: http://trac.edgewall.org/intertrac/log:/branches/1.6-stable@17848 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Oct 3, 2024
1 parent b088f60 commit 186e5c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion trac/notification/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ def _do_send(self, transport, event, message, cc_addrs, bcc_addrs):
set_header(message, 'Cc', addresses=cc_addrs)
if bcc_addrs:
set_header(message, 'Bcc', addresses=bcc_addrs)
set_header(message, 'Reply-To', addresses=[smtp_replyto])
if smtp_replyto:
set_header(message, 'Reply-To', addresses=[smtp_replyto])

for decorator in self.decorators:
decorator.decorate_message(event, message, self._charset)
Expand Down
16 changes: 16 additions & 0 deletions trac/notification/tests/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,22 @@ def test_username_is_email(self):
self._assert_equal_sets(['[email protected]'],
self._cclist(message['Cc']))

def test_replyto(self):
config = self.env.config
config.set('notification', 'smtp_replyto', '[email protected]')
self._notify_event('blah')
history = self.sender.history
from_addr, recipients, message = history[0]
self.assertEqual('[email protected]', message['Reply-To'])

def test_replyto_empty(self):
config = self.env.config
config.set('notification', 'smtp_replyto', '')
self._notify_event('blah')
history = self.sender.history
from_addr, recipients, message = history[0]
self.assertNotIn('Reply-To', message)


class RecipientMatcherTestCase(unittest.TestCase):

Expand Down

0 comments on commit 186e5c3

Please sign in to comment.