5

Python has a email module in the standard library.

But this library is still very low-level.

For example getting the unicode string from a mail needs coding: https://stackoverflow.com/q/4157899/633961

I think this should be one method call. Not more.

Is there a high level library for parsing email in Python?

2
  • 1
    I have no experience with this, but am I to assume you've already done a Google search the the obvious hits like pypi.org/project/mail-parser and github.com/mailgun/flanker aren't appropriate?
    – Eric S
    Aug 31, 2018 at 21:39
  • 1
    I am looking for a recommendation. Copy+Paste from pypi is not what I am looking for.
    – guettli
    Sep 4, 2018 at 7:25

1 Answer 1

1

A quick google search returned the mail-parser library which looks nice and succinct.

https://pypi.org/project/mail-parser/

From the docs:

mail-parser takes as input a raw email and generates a parsed object.
The properties of this object are the same name of RFC headers:
 bcc
 cc
 date
 delivered_to
 from_ (not from because is a keyword of Python)
 message_id
 received
 reply_to
 subject
 to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.