From 3c84b49725fd430ec71c5dc1b8ae0fb069fe6e53 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sat, 25 May 2019 20:30:14 +0100 Subject: 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" 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. --- alot/db/utils.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'alot') 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) -- cgit v1.2.3