4

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.

2 Answers2

7

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.

larsks
  • 41,276
  • 13
  • 117
  • 170
  • 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
0

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: https://stackoverflow.com/questions/8307809/save-email-attachment-python3-pop3-ssl-gmail

brent
  • 3,481
  • 3
  • 25
  • 37