I just downloaded all my Gmail with the new download functionality from Google, and it gives me a large .mbox file. What would be a basic shell of a script to start extracting and processing individual emails from the file?
Data in Mbox to JSON or CSV?
2.7k Views Asked by earlygrey At
2
There are 2 best solutions below
0

The book "Mining the Social Web" (O'Reilly, 2nd ed.) by Matthew Russell gives some code for doing this in Python. His code is all on github. You will want the files prefixed with 'mailbox'. https://github.com/ptwobrussell/Mining-the-Social-Web/tree/master/python_code
Check out this GitHub repo - https://github.com/PS1607/mbox-to-json
Also extracts the Attachments for you.
If you want to convert it into CSV instead, change line 55 in src/main.py from
df.to_json
todf.to_csv