I'm trying to build a solution to transfer attachments from Mail to an FTP folder. Are there any suggestions to solve this task?
My first idea was to write a shell script which fetches the mail from the Cyrus /var/imap folder and searches for the mail attachment finally writing it into a pdf file. As this does not seem to be the intended way of solving this issue, there might be a better one.
Best Answer
With ripmime and cronjob you can solve this problem. Ripmime is a tools to fetch MIME parts of a Mail. You can fetch text and attachments and extract it to an folder. With cronjob you can start a shellscript that looks into Maildir and starts ripmime for each Mail.
Install ripmime from http://www.pldaniels.com/ripmime/
After that I use this shellscript for fetch the attachments:
With crontab -e you can add this Task:
After you get a Mail in /var/spool/... this Script call ripmime and extract the Attachment to ftp dir.