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.

Thanks!