import email msg = b"""From xyz Content-Type: multipart/mixed; boundary="1" Content-Transfer-Encoding: \xc8""" email.message_from_bytes(msg)