Skip to content

Commit 7b1a854

Browse files
committed
issue2550803: Replying to NOSY mail goes to the tracker through
reply-to, not original message author. Created new [tracker] replyto_address config.ini option to allow: 1) setting reply-to header to the tracker 2) setting reply-to header to the address of the author of the change 3) setting it to a fixed address (like [email protected]) Proposal by Peter Funk (pefu) in discussion with Tom Ekberg (tekberg). I chose to re-retrieve the email address for the author from the database rather than adding a new variable. Also managed to make a test case for each of the three settings.
1 parent 86b6a56 commit 7b1a854

File tree

5 files changed

+199
-2
lines changed

5 files changed

+199
-2
lines changed

CHANGES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ Features:
7878
indexer. See ``doc/upgrading.txt`` for details. Initial patch
7979
done by David Wolever. Patch modified, docs added and committed
8080
by John Rouillard.
81+
- issue2550803: Replying to NOSY mail goes to the tracker through
82+
reply-to, not original message author.
83+
Created new [tracker] replyto_address config.ini option to allow:
84+
1) setting reply-to header to the tracker
85+
2) setting reply-to header to the address of the author
86+
of the change
87+
3) setting it to a fixed address (like [email protected])
88+
Done by John Rouillard from proposal by Peter Funk (pefu)
89+
in discussion with Tom Ekberg (tekberg). See doc/upgrading.txt.
8190

8291
Fixed:
8392

doc/upgrading.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,34 @@ setting this value in the [main] section of the tracker's
6565
# Possible values: xapian, whoosh, native (internal).
6666
indexer =
6767

68+
New config file option 'replyto_address' added
69+
----------------------------------------------
70+
71+
A new config file option has been added to let you control the
72+
Reply-To header on nosy messages.
73+
74+
Edit your tracker's ``config.ini`` and place the following after
75+
the email entry in the tracker section::
76+
77+
[tracker]
78+
...
79+
80+
# Controls the reply-to header address used when sending
81+
# nosy messages.
82+
# If the value is unset (default) the roundup tracker's
83+
# email address (above) is used.
84+
# If set to "AUTHOR" then the primary email address of the
85+
# author of the change will be used as the reply-to
86+
# address. This allows email exchanges to occur outside of
87+
# the view of roundup and exposes the address of the person
88+
# who updated the issue, but it could be useful in some
89+
# unusual circumstances.
90+
# If set to some other value, the value is used as the reply-to
91+
# address. It must be a valid RFC2822 address or people will not be
92+
# able to reply.
93+
# Default:
94+
replyto_address =
95+
6896
html/_generic.404.html in trackers use page template
6997
----------------------------------------------------
7098

roundup/configuration.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,20 @@ def str2value(self, value):
588588
(MailAddressOption, "email", "issue_tracker",
589589
"Email address that mail to roundup should go to.\n"
590590
"If no domain is specified then mail_domain is added."),
591+
(Option, "replyto_address", "",
592+
"Controls the reply-to header address used when sending\n"
593+
"nosy messages.\n"
594+
"If the value is unset (default) the roundup tracker's\n"
595+
"email address (above) is used.\n"
596+
"If set to \"AUTHOR\" then the primary email address of the\n"
597+
"author of the change will be used as the reply-to\n"
598+
"address. This allows email exchanges to occur outside of\n"
599+
"the view of roundup and exposes the address of the person\n"
600+
"who updated the issue, but it could be useful in some\n"
601+
"unusual circumstances.\n"
602+
"If set to some other value, the value is used as the reply-to\n"
603+
"address. It must be a valid RFC2822 address or people will not be\n"
604+
"able to reply."),
591605
(NullableOption, "language", "",
592606
"Default locale name for this tracker.\n"
593607
"If this option is not set, the language is determined\n"

roundup/roundupdb.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,18 @@ def send_message(self, issueid, msgid, note, sendto, from_address=None,
532532

533533
message = mailer.get_standard_message(multipart=message_files)
534534

535-
# set reply-to to the tracker
536-
message['Reply-To'] = tracker_name
535+
# set reply-to as requested by config option TRACKER_REPLYTO_ADDRESS
536+
replyto_config = self.db.config.TRACKER_REPLYTO_ADDRESS
537+
if replyto_config:
538+
if replyto_config == "AUTHOR":
539+
# note that authaddr at this point is already surrounded by < >, so
540+
# get the original address from the db as nice_send_header adds < >
541+
replyto_addr = nice_sender_header(authname, users.get(authid, 'address', ''), charset)
542+
else:
543+
replyto_addr = replyto_config
544+
else:
545+
replyto_addr = tracker_name
546+
message['Reply-To'] = replyto_addr
537547

538548
# message ids
539549
if messageid:

test/test_mailgw.py

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,142 @@ def testNosyRemove(self):
19631963
# NO NOSY MESSAGE SHOULD BE SENT!
19641964
assert not os.path.exists(SENDMAILDEBUG)
19651965

1966+
def testNosyReplytoTracker(self):
1967+
self.db.config.TRACKER_REPLYTO_ADDRESS = ''
1968+
self._handle_mail('''Content-Type: text/plain;
1969+
charset="iso-8859-1"
1970+
From: Chef <[email protected]>
1971+
1972+
Message-Id: <dummy_test_message_id>
1973+
Subject: [issue] Testing... [nosy=mary; assignedto=richard]
1974+
1975+
This is a test submission of a new issue.
1976+
''')
1977+
self.compareMessages(self._get_mail(),
1978+
1979+
1980+
Content-Type: text/plain; charset="utf-8"
1981+
Subject: [issue1] Testing...
1982+
1983+
From: "Bork, Chef" <[email protected]>
1984+
Reply-To: Roundup issue tracker
1985+
1986+
MIME-Version: 1.0
1987+
Message-Id: <dummy_test_message_id>
1988+
X-Roundup-Name: Roundup issue tracker
1989+
X-Roundup-Loop: hello
1990+
X-Roundup-Issue-Status: unread
1991+
Content-Transfer-Encoding: quoted-printable
1992+
1993+
1994+
New submission from Bork, Chef <[email protected]>:
1995+
1996+
This is a test submission of a new issue.
1997+
1998+
----------
1999+
assignedto: richard
2000+
messages: 1
2001+
nosy: Chef, mary, richard
2002+
status: unread
2003+
title: Testing...
2004+
tx_Source: email
2005+
2006+
_______________________________________________________________________
2007+
Roundup issue tracker <[email protected]>
2008+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2009+
_______________________________________________________________________
2010+
''')
2011+
2012+
def testNosyReplytoSomeaddress(self):
2013+
self.db.config.TRACKER_REPLYTO_ADDRESS = '[email protected]'
2014+
self._handle_mail('''Content-Type: text/plain;
2015+
charset="iso-8859-1"
2016+
From: Chef <[email protected]>
2017+
2018+
Message-Id: <dummy_test_message_id>
2019+
Subject: [issue] Testing... [nosy=mary; assignedto=richard]
2020+
2021+
This is a test submission of a new issue.
2022+
''')
2023+
self.compareMessages(self._get_mail(),
2024+
2025+
2026+
Content-Type: text/plain; charset="utf-8"
2027+
Subject: [issue1] Testing...
2028+
2029+
From: "Bork, Chef" <[email protected]>
2030+
2031+
MIME-Version: 1.0
2032+
Message-Id: <dummy_test_message_id>
2033+
X-Roundup-Name: Roundup issue tracker
2034+
X-Roundup-Loop: hello
2035+
X-Roundup-Issue-Status: unread
2036+
Content-Transfer-Encoding: quoted-printable
2037+
2038+
2039+
New submission from Bork, Chef <[email protected]>:
2040+
2041+
This is a test submission of a new issue.
2042+
2043+
----------
2044+
assignedto: richard
2045+
messages: 1
2046+
nosy: Chef, mary, richard
2047+
status: unread
2048+
title: Testing...
2049+
tx_Source: email
2050+
2051+
_______________________________________________________________________
2052+
Roundup issue tracker <[email protected]>
2053+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2054+
_______________________________________________________________________
2055+
''')
2056+
2057+
def testNosyReplytoAuthor(self):
2058+
self.db.config.TRACKER_REPLYTO_ADDRESS = 'AUTHOR'
2059+
self._handle_mail('''Content-Type: text/plain;
2060+
charset="iso-8859-1"
2061+
From: Chef <[email protected]>
2062+
2063+
Message-Id: <dummy_test_message_id>
2064+
Subject: [issue] Testing... [nosy=mary; assignedto=richard]
2065+
2066+
This is a test submission of a new issue.
2067+
''')
2068+
self.compareMessages(self._get_mail(),
2069+
2070+
2071+
Content-Type: text/plain; charset="utf-8"
2072+
Subject: [issue1] Testing...
2073+
2074+
From: "Bork, Chef" <[email protected]>
2075+
Reply-To: "Bork, Chef" <[email protected]>
2076+
MIME-Version: 1.0
2077+
Message-Id: <dummy_test_message_id>
2078+
X-Roundup-Name: Roundup issue tracker
2079+
X-Roundup-Loop: hello
2080+
X-Roundup-Issue-Status: unread
2081+
Content-Transfer-Encoding: quoted-printable
2082+
2083+
2084+
New submission from Bork, Chef <[email protected]>:
2085+
2086+
This is a test submission of a new issue.
2087+
2088+
----------
2089+
assignedto: richard
2090+
messages: 1
2091+
nosy: Chef, mary, richard
2092+
status: unread
2093+
title: Testing...
2094+
tx_Source: email
2095+
2096+
_______________________________________________________________________
2097+
Roundup issue tracker <[email protected]>
2098+
<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2099+
_______________________________________________________________________
2100+
''')
2101+
19662102
def testNewUserAuthor(self):
19672103
self.db.commit()
19682104
l = self.db.user.list()

0 commit comments

Comments
 (0)