[issue32058] Faulty behaviour in email.utils.parseaddr if square brackets in subject

2017-11-17 Thread tom de wulf
tom de wulf added the comment: I do get this data from an IMAP fetch statement, see my code below: rv, data = imap.fetch(num, "(BODY[HEADER.FIELDS (FROM SUBJECT)])") if rv != 'OK': logging.error("Error getting message sender and subjec

[issue32058] Faulty behaviour in email.utils.parseaddr if square brackets in subject

2017-11-17 Thread tom de wulf
New submission from tom de wulf : Probably a parsing bug in email.utils.parseaddr. How to recreate: >>> import email.utils >>> test = 'Subject: I am a bug [Random]\r\nFrom: someone >>> \r\n\r\n' >>> email.utils.parseaddr(test) ('',