Is there a linux email client that can run on command line and can be configured to fetch and automatically save attachments to the filesystem?

Im currently using Thunderbird and it has a nice add-on called 'Attachment extractor' which automatically downloads attachments to the filesystem once the mail arrives. My problem is I want to run a custom php script the can process the attached file once it arrives.



if you are receiving the email locally, metamail can probably do what you're looking for. many linux distros have a package for metamail.

here's a little information about it: http://www.cs.umd.edu/faq/mime.html

Otherwise, you may be able to work something out with fetchmail + procmail.


You can use fetchmail and procmail to do this. Procmail can be configured to execute a script that tests if an email has any mime encoded attachments (this could be as simple as just grepping the file for the MIME header) and then invokes munpack if it has.

Procmail can execute pretty much anything you want, so you should be able to get it to run your php script or a shell wrapper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.