Created
August 28, 2012 13:44
-
-
Save jiphex/3498110 to your computer and use it in GitHub Desktop.
Email html parser thingy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import email.parser | |
import base64 | |
if(len(sys.argv) < 2): | |
print "No email file specified!" | |
sys.exit(1) | |
p = email.parser.Parser() | |
m = p.parse(open(sys.argv[1], 'r')) | |
for part in m.walk(): | |
if(part.get_content_type() == "text/html"): | |
print base64.decodestring(part.get_payload()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment