Edgewall Software
Modify

Opened 4 months ago

Closed 7 weeks ago

#13770 closed defect (fixed)

`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:

Fixed incorrect Reply-To: <> header generated in notification mail when smtp_replyto not configured.

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):  
    646646            set_header(message, 'Cc', addresses=cc_addrs)
    647647        if bcc_addrs:
    648648            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])
    650651
    651652        for decorator in self.decorators:
    652653            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):  
    509509        self._assert_equal_sets(['cc@example.org'],
    510510                                self._cclist(message['Cc']))
    511511
     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
    512528
    513529class RecipientMatcherTestCase(unittest.TestCase):
    514530

Attachments (0)

Change History (1)

comment:1 by Jun Omae, 7 weeks ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [17848] and merged in [17850].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.