process mailbox and extract attachments to directory

<p>Given is a network scanner, which has the ability to mail scans to a mailbox. the solution should contain a mailbox on a linux (ubuntu) server (already there) to which the mails are sent. in order to automate to process of opening a mail client and saving the attached scans to a folder, a script should be developed which listens for new mails in the mailbox and automatically extracts the attachments and saves them to a folder.</p>
1 answer

perl script for that solution

this is a simple perl script using mbox:parser to check for mails and store the attachments to a given folder...
can be invoked by crontab (also takes care of emptying the box) e.g.:
/1 * * * * root sudo -u scans getscans >> /data/daten/000_Scans_Server/00logfile.txt; chmod a+r /data/daten/000_Scans_Server/00logfile.txt; echo -n > /var/mail/scans

Taggings: