Download gmail attachments

February 6, 2007

Here is a bit of code I put together using libgmail and python to download the attachments of all emails with a given label in my gmail account. It is pretty simple and the libgmail library can enable you to do the same thing for emails in a certain folder, or emails as the result of a certain search term. The code isn’t incredibly robust, but it gets the job done.

I call mine getatt and it run it like this:

getatt mylabel

It then drops each attachment out as a separate file in the current directory. I use it for grading I have to do for an undergraduate class where I am getting hundreds of emails a week with attachments I have to grade.

Python Code: getatt

comments powered by Disqus
Download Gmail Attachments - February 6, 2007 - Jonah Duckles