Extract Zip from Email


Director of Common Sense
I receive a daily e-mail with a zip file attached. I want to extract that zip file, and save it to my server (Linux).

Is this a job for procmail?

I could also create a filter in gmail, if the sender matches & there's an attachment, forward the message somewhere else (some sort of 3rd party service that accepts files via e-mail, and has an API that I can download the file automatically).

Apparently Google Docs used to have this, but they've disabled it & haven't turned it back on (or have they? I can't find it anywhere). I could get the file out of Google Docs, if I could get it in there in the first place.


EQ Forum Admin
Staff member
It should be possible with a perl script using the MIME::parser module.

It was faster for me to create a working solution with procmail as you suggested and using a program called munpack.

Example procmail recipe :

:0 c
* ^Subject: Files Attached
| /usr/local/bin/munpack -q -C /mnt/persistent/files/