[New-bugs-announce] [issue45932] EmailMessage incorrectly splits reply-to header

Alexander Mohr report at bugs.python.org
Mon Nov 29 17:10:40 EST 2021


New submission from Alexander Mohr <thehesiod at gmail.com>:

If you have a reply-to list that contains a name with a comma it must be quoted, however if the line length is just right python with split the name incorrectly and not keep the quote.  Note that the CC line keeps the quote in the name but the reply-to does not, presumably since the line is slightly longer.

example:
from email.message import EmailMessage


def main():
    message = EmailMessage()
    message['From'] = 'no-reply at farmersbusinessnetwork.com'
    message['Reply-To'] = """MEGAN FOOOBAAAAAR <abcfghijkladbfrg at akdja.com>,"KDJEHGI, SCOTT KJUYT" <abcfghijkladbfrg at akdja.com>"""
    message['To'] = """"KDJEHGI, SCOTT KJUYT" <SCOTT.KDJEHGI at MYFNBBANK.COM>"""
    message['Subject'] = "does not matter"
    message['CC'] = """MEGAN FOOOBAAAAAR <abcfghijkladbfrg at akdja.com>,"KDJEHGI, SCOTT KJUYT" <abcfghijkladbfrg at akdja.com>"""
    message.set_content('foo bar')
    print(message.as_string())


if __name__ == '__main__':
    main()

----------
components: email
messages: 407329
nosy: barry, r.david.murray, thehesiod
priority: normal
severity: normal
status: open
title: EmailMessage incorrectly splits reply-to header
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45932>
_______________________________________


More information about the New-bugs-announce mailing list