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.
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.
I cannot support the way you want it! Email is not for sending files. See this question and the answers: Why do we still have such small email attachment filesize restrictions?
FTP already is for file transfer. So do not wrap files in mails to get them transferred. If you don't want to transfer files via FTP then look for something different. But not Email.