GOVCERT-LU/eml_parser

Email body parsing

cooper-a opened this issue · 2 comments

Are there any branches to extract the email body?

Just in case anyone else sees this when wondering "wait, I parsed the .eml file, where is the body?" when using this library, like I did:

This eml_parser library doesn't parse the body of emails by default. If you want it to parse and include the body of the emails, you have to pass the include_raw_body=True parameter when instantiating the eml_parser.EmlParser. Here's a code snippet:

ep = eml_parser.EmlParser(include_raw_body=True) # have to set to True to get the body of the email
email = ep.decode_email('./example.eml')
# now you can access the body, like this:
#     email['body'][0]['content']