emaildata is a python package for extracting content from email messages.
From the examples:
from emaildata.text import Text
message = email.message_from_file(open('message.eml'))
text = Text.text(message)
This combided with the standard python
os.walk() functions should make this a breeze to perform this as a batch operation.
- Gratis Yes
- Cross Platform (inc Linux)
- Batch/Script Yes
Testing it out
As an example, I exported an email from Quora, (Using Mozilla Thunderbird), as a file and fired up iPython:
Looking through it there were no =3D, =20 entries, (other than in a couple of the urls), but there were a number of sequences like
\xe2\x80\x9cused car salesman\xe2\x80\x9d that needed sorting out, these are unicode sequence.
unicode(text, 'utf-8') to decode and printing, (with a unicode compatible font), gives:
Where we find that
\xe2\x80\x9cused car salesman\xe2\x80\x9d is “used car salesman” note the up & down quotes.
If you need to decode the parts of a URL with query then you can use
urllib.unquote() to deal with them but for your usage you are probably not interested in URLs be they queries or not.