Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
1b4d5002 by Mark Sapiro at 2021-05-21T10:39:07-07:00
Message senders method gets all addresses from a header.
- - - - -
91a2a847 by Mark Sapiro at 2021-05-21T18:03:57+00:00
Merge branch 'send' into 'master'
Message senders method gets all addresses from a header.
See merge request mailman/mailman!868
- - - - -
3 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/email/message.py
- src/mailman/email/tests/test_message.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -51,7 +51,7 @@ Bugs
* Some exceptions in ARC signing of some posts from HyperKitty and some from
prod.outlook.com are now handled without shunting the message. (Closes #885)
* Command runner now will decode the message body before processing it.
- (Closes #859)
+ (Closes #859)
* The ``mailinglist`` table ``info`` column is changed to Text. (Closes #840
and #886)
* The mailing list administrators roster ``get_member()`` method now returns
@@ -65,8 +65,10 @@ Bugs
accept emojis and other 4-byte unicode characters by using the utf8mb4
character set instead of 3-byte. (Closes #891)
* LMTP runner now sets unixfrom in incoming messages. (Closes #904)
-* Message RFC2047-decodes and unfolds headers before looking for
- senders. (Closes #903)
+* The ``Message`` ``senders()`` method now RFC2047-decodes and unfolds headers.
+ (Closes #903)
+* The ``Message`` ``senders()`` method now gets all the addresses from the
+ configured headers. (Closes #905)
Command line
------------
=====================================
src/mailman/email/message.py
=====================================
@@ -113,8 +113,9 @@ class Message(email.message.Message):
'',
str(make_header(decode_header(field_value)))
)
- name, address = email.utils.parseaddr(header_value)
- senders.append(address.lower())
+ for name, address in email.utils.getaddresses(
+ [header_value]):
+ senders.append(address.lower())
# Filter out invalid addresses, None and the empty string, and convert
# to unicode.
clean_senders = []
=====================================
src/mailman/email/tests/test_message.py
=====================================
@@ -107,6 +107,15 @@ Test content
)
self.assertEqual(msg.senders, ['[email protected]'])
+ def test_senders_multiple_addresses(self):
+ msg = Message()
+ msg['From'] = 'Anne <[email protected]>'
+ msg['Reply-To'] = 'Bart <[email protected]>, Cate <[email protected]>'
+ self.assertEqual(msg.senders,
+ ['[email protected]',
+ '[email protected]',
+ '[email protected]'])
+
def test_user_notification_bad_charset(self):
msg = UserNotification(
'[email protected]',
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/7775c730b6a3225ebdcb60a8e6d8b14bc7975d06...91a2a8474d4807c683c6e4ccbcca728043a4a5a2
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/7775c730b6a3225ebdcb60a8e6d8b14bc7975d06...91a2a8474d4807c683c6e4ccbcca728043a4a5a2
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]