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.
Comments on “automatically extract email attachments with common linux tools”
Thanks for this. I’m attempting to use it in conjunction with an automated upload to FTP for reports. This makes it a whole lot easier.
Happy it could help you 🙂
Thanks a lot, you saved my day! 🙂
Comments are closed.