Because you are using Python3, instead of using: email.message_from_string(raw_email) use: email.message_from_bytes(raw_email) Using the first line of code, on a gmail client, would raise an exception.