I went looking for a command line utility to save the attachments in emails to their respective files, and found the m pack / munpack utility. Munpack will attempt to save each of the email attachments as the original file. There were two things about the program which I didn’t like, so I changed it.
1. If the file already exists it previously saved a new copy of the file with the filename being filename.ext.1 then filename.ext.2 then filename.ext.3 etc. This of course messes up the file extension for re-opening the file in its associated application. So I modified munpack to append the incremented value rather then pre-pend
2. Munpack saves the text part of the email message as filename.desc. Since my ultimate purpose for munpack is to create and email filter to save the attachment to a directory and then insert a hyper-link to the file, I don’t care about the desc part. So I just delete it.
Directions
Download the source from somewhere or here:
# wget http://www.4devz.com/mpack-1.6.tar.gz
# tar -zxf mpack-1.6.tar.gz
# cd mpack-1.6
# wget http://www.4devz.com/mpack.patch
# patch -p1 < ./mpack.patch
# ./configure
# make
# make install
Enjoy!
Related posts:





























Hi, sadly these files aren’t online anymore. Could you put them on again? Thank you!