If you try to parse .eml files using Python, you'll probably find the standard library email module. If you have an .eml file in memory as bytes you might try something like this:
import email
eml_bytes: bytes = b'EML things here'
eml = email.message_from_bytes(eml_bytes)
This will work wonderfully until you get a real-world email with a subject of =?UTF-8?B?8J+SqiBTdHJlbmd0aCAxMDE6IEhlYWx0aCBiZW5lZml0cw==?=.
This is not junk, it's a newsletter from NPR with a very human-readable subject that happens to contain an emoji. EML files often encode values in ways you don't see elsewhere around the web, and the default way that Python will parse the file (its policy) does not handle it well.
The default policy is actually not the one named default, but one named Compat32.
"...the default behavior of the email package is to maintain compatibility with Python 3.2."
To decode that subject for you, you need to pass in that default policy (the one that isn't the default!):
import email
import email.policy
eml_bytes: bytes = b'EML things here'
eml = email.message_from_bytes(eml_bytes, policy=email.policy.default)
Then you'll have email.get("Subject") return, in this case, 💪 Strength 101: Health benefits.
Happy parsing!