diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2019-05-25 20:30:14 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-05-27 10:19:21 +0100 |
commit | 3c84b49725fd430ec71c5dc1b8ae0fb069fe6e53 (patch) | |
tree | 0ed29de3396044b2ca9c00ede2d6049bad393ad4 /alot | |
parent | 00e6ca8a87dcb23c423e088bec2057dcf5158f49 (diff) |
do not remove quotes around realname parts
when decoding headers containing email addresses;
Some MUAs (exchange) will add headers in the form:
To: "Last, First" <x@y.z>
Prior to this commit, alot would remove the quotes (apparently they
violate RFC 2047). However, this then would lead to problems where the
additional comma is interpreted as separator between several recipients.
This commit causes alot to not remove the quotes.
Diffstat (limited to 'alot')
-rw-r--r-- | alot/db/utils.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index 94886148..75fc0178 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -526,15 +526,9 @@ def decode_header(header, normalize=False): :type normalize: bool :rtype: str """ - # some mailers send out incorrectly escaped headers - # and double quote the escaped realname part again. remove those - # RFC: 2047 - regex = r'"(=\?.+?\?.+?\?[^ ?]+\?=)"' - value = re.sub(regex, r'\1', header) - logging.debug("unquoted header: |%s|", value) - - # otherwise we interpret RFC2822 encoding escape sequences - valuelist = email.header.decode_header(value) + logging.debug("unquoted header: |%s|", header) + + valuelist = email.header.decode_header(header) decoded_list = [] for v, enc in valuelist: v = string_decode(v, enc) |