Skip to content

Instantly share code, notes, and snippets.

@pacuna
Forked from davidpelayo/mbox-to-csv.py
Created April 2, 2018 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacuna/4a726e9183ee2618f5a17f6c07377af8 to your computer and use it in GitHub Desktop.
Save pacuna/4a726e9183ee2618f5a17f6c07377af8 to your computer and use it in GitHub Desktop.
Simple mbox parser to csv in Python
import mailbox
import csv
writer = csv.writer(open("mbox-output.csv", "wb"))
for message in mailbox.mbox('file.mbox/mbox'):
writer.writerow([message['message-id'], message['subject'], message['from']])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment