-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
Bug report
Bug description:
Given an address text of the form: John Smith, Jr <johnsmith@example.com>
Because of the unquoted comma, the text is parsed as two addresses:
"John" <@smith>, "Jr" <johnsmith@example.com>
This is of greatest concern if the object is supposed to be a SingleAddressHeader.
I have also encountered TO and CC strings that have incomplete address specifications, containing only a Friendly Name. For these messages, I am only interested in the valid addresses, although others may want the existing behavior.
To work around both the parsing problem and the invalid address terms, I created a sub-class which discards any address where username or domain are not strings. My workaround does not correct for the incomplete Friendly Name, but it ensures a correct count of valid addresses. It would be desirable to implement a trap for unquoted commas, but there are so many challenges to parsing address lists correctly, I wonder if fixing the unquoted comma problem will create other headaches.
Problem observed on Python 3.11.3150.0 and Python 3.8.1
CPython versions tested on:
3.11
Operating systems tested on:
Windows