Skip to content

Commit

Permalink
1.7.1dev: merge [17848] from 1.6-stable (fix for #13770)
Browse files Browse the repository at this point in the history
git-svn-id: http://trac.edgewall.org/intertrac/log:/trunk@17850 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Oct 3, 2024
2 parents a016dd4 + 186e5c3 commit f3d34bd
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(['cc@example.org'],
self._cclist(message['Cc']))

def test_replyto(self):
config = self.env.config
config.set('notification', 'smtp_replyto', 'replyto@example.org')
self._notify_event('blah')
history = self.sender.history
from_addr, recipients, message = history[0]
self.assertEqual('replyto@example.org', 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 f3d34bd

Please sign in to comment.