Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

It looks like mpack is not shipped with RHEL. Is there a command line MIME extractor (i.e. something that can be used from a shell script) shipped with RHEL 5 that does not require installing a third party package or building from source?

The powers that beTM won't be keen on using anything that's not packaged by the vendor, so I'd prefer to use something that comes with RHEL 5 if possible.

share|improve this question

2 Answers 2

The perl-MIME-tools package includes a variety of command-line tools for processing MIME-encoded messages, including mimeexplode:

Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into subdirectories of
the current working directory.  The subdirectories are just called
"msg0", "msg1", "msg2", etc.  Existing directories are skipped
over.

The ripmime command is packaged in EPEL, if that meets your "packaged by the vendor" requirements.

share|improve this answer
    
Not my requirements but those of the people managing the system - really if it can't be installed through RPM from the stuff that comes with the distro it will be a hard sell. However, I will engage them on using mpack as you can get third party RPMS built agains the RHEL libs. –  ConcernedOfTunbridgeWells May 15 '12 at 18:29
    
Just making sure you followed my answer: perl-MIME-tools is part of RHEL5 and probably does what you want. You could just use that and you'd be all set. –  larsks May 15 '12 at 18:33
    
perl-MIME-tools might well be a goer as they've already got perl in the build. –  ConcernedOfTunbridgeWells May 15 '12 at 18:42

By MIME do you mean Base64? OpenSSL can be used to decode Base64,

openssl enc -d -base64 -in file.in -out file.out

Edit:

Since that is not the case, Python (which is part of the default RHEL install) includes the email module which can be used to consume and interpret emails, including dealing with attachments. The documentation is located here: http://docs.python.org/library/email.parser.html

Obviously there is some programming required, there is a SO question covering it: http://stackoverflow.com/questions/8307809/save-email-attachment-python3-pop3-ssl-gmail

share|improve this answer
    
No, I mean something that can pull a MIME attachment out of an email as well as decode it. –  ConcernedOfTunbridgeWells May 15 '12 at 16:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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