LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Automatically save email attachments (https://www.linuxquestions.org/questions/linux-software-2/automatically-save-email-attachments-753144/)

mpyusko 09-06-2009 04:44 PM

Automatically save email attachments
 
Is there a way to automatically save file attachments to a specific location? I have a service that emails me daily data files. I would like to be able to have these file placed in a specific folder each time they come in so I don't have to do it manually for 6 files a day. It gets a little tedious and then if I forget..... oh well, you get the idea.

Thanks.

unSpawn 09-07-2009 05:10 AM

Depending on how you receive email (mailserver, fetchmail, fetched directly with mail client?) that could be automated using a Procmail recipe.

mpyusko 09-18-2009 02:41 PM

I'm using Kmail as my mail client.

Now I've been playing with this for a few days and I can't seem to make it work automatically. I setup a filter in kmail to take all messages with "[GEO]" in the subject and pipe through "procmail". I created a .procmailrc file that is supposed to take all messages piped to it with "[GEO]" in the subject and pipe them through "ripmime". Ripmime is then supposed to extract the attachment from the email message and place it neatly in the /home/mpyusko/Desktop/gc folder.

Now I know my ripmime command is ok, because I can locate the specific message in the maildir and execute the commad on it and the zip file shows up where it is supposed to be. I think my issue lies in the execution of procmail.

The whole point is, I get pocket queries from Geocaching.com and each day superseeds the previous day. So it makes more sense to automatically save them all in the same folder where I only have one copy that is always the most up to date.

If I can get this working, then I can use it for a few other tasks as well.

Code:

cat .procmailrc

:0
* ^Content-Type:.*multipart/mixed
* ^Subject:.*[GEO]
| ripmime -i - -d /home/mpyusko/Desktop/gc --syslog --paranoid --no-nameless --overwrite &&\

Thanks!


All times are GMT -5. The time now is 05:43 AM.