New submission from Alexander Mohr <thehes...@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-re...@farmersbusinessnetwork.com'
    message['Reply-To'] = """MEGAN FOOOBAAAAAR 
<abcfghijkladb...@akdja.com>,"KDJEHGI, SCOTT KJUYT" 
<abcfghijkladb...@akdja.com>"""
    message['To'] = """"KDJEHGI, SCOTT KJUYT" <scott.kdje...@myfnbbank.com>"""
    message['Subject'] = "does not matter"
    message['CC'] = """MEGAN FOOOBAAAAAR <abcfghijkladb...@akdja.com>,"KDJEHGI, 
SCOTT KJUYT" <abcfghijkladb...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45932>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to