Extract Zip from Email

Discussion in 'Email Discussions' started by esnagel, Nov 19, 2010.

  1. esnagel

    esnagel Director of Common Sense

    Joined:
    Oct 23, 2008
    Messages:
    20
    Likes Received:
    0
    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.
     


  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,983
    Likes Received:
    120
    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/
     

  3. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,983
    Likes Received:
    120

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...