How can I export my emails from gmail programmatically?
Well this is a question I hear again and again. I decided to do something about it and the result is a short python utility that accesses gmail with a username and password over SSL.
You can get the export-gmail script here.
Execute like so:
#python export-gmail.py timtam t0psecret INBOX save
Running the script like the line above, with the save keyword will...
1. Connect to the gmail service using the username timtam and the password t0psecret
2. Select the folder INBOX (for Trash use Trash etc.)
3. Retrieve a list of available messages uniques ids
4. If save was given as a run line option compare the list from 3 with what is previously known
5. Retrieve each email from 4 and print to screen
6. If save was used then same the emails details into a local DB.
There are lots of places to improve this but for now it will get you going.
No comments:
Post a Comment