I had need to automatically process emails to a specific address to pull attachments out, and this is how I did it:
$ yum install mpack $ cat extract-attach.sh #!/bin/bash rm -rf ~/attachtmp mkdir ~/attachtmp mv ~/Maildir/new/* ~/attachtmp cd ~ munpack ~/attachtmp/* rm -rf ~/attachtmp $ crontab -l */5 * * * * ~/extract-attach.sh
Why, you may ask? Because I get a report a few times per day to the email address in question.
Note – this runs in my crontab every 5 minutes on a CentOS 6 x64 server; I’m sure the process is similar/identical on other distros, but I haven’t personally tried.