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