Extract e-mail attachments on Unix
I would take a look at MH and its successor, NMH. From the FAQ:
The MH message handling system is a set of electronic mail programs in the public domain. If your computer runs Unix, it can probably run MH.
The big difference between MH and most other "mail user agents" is
that you can use MH from a Unix shell prompt. In MH, each command is a separate program, and the shell is used as an interpreter. So, all the power of Unix shells (pipes, redirection, history, aliases, and
so on) works with MH--you don't have to learn a new interface. Other mail agents have their own command interpreter for their individual
mail commands (although the mush mail agent simulates a Unix shell).