Extract email attachments on Unix

Do you know how to extract attachments from a raw mail message on Unix? I want to do this from a shell script (ksh). A mail file is a raw email with headers and encoded attachments.

PS: I can not use perl!

thanks.

+6
unix shell email
source share
4 answers

mpack did it for me! (actually part of munpack) Exactly what I needed: a tiny stand-alone executable without additional resources.

+7
source share

A long time ago I used a metamail for this kind of thing.

see http://kb.iu.edu/data/aibt.html

M.

+2
source share

I would look at MH and his successor NMH . From the FAQ:

MH's message processing system is a collection of email programs in the public domain. If your computer runs Unix, it may be running MH.

The big difference between MH and most other "mail user agents" is that you can use MH from the Unix shell immediately. In MH, each command is a separate program, and the shell is used as a translator. So, all the power of Unix shells (pipes, redirection, history, aliases and
and so on) works with MH - you do not have to learn a new interface. Other mail agents have their own translation team for their individual mail (although the mail agent mimics the Unix shell).

+2
source share

Another solution is to use uudeview . It works like munpack . Just enter

$ uudeview file.eml

+2
source share

All Articles