Extracting a MIME/Base64 attachment from /var/spool/mail

Kenneth Kirchner ken at kirchners.com
Thu Mar 4 03:12:25 UTC 2010


Hello all,

  I am trying to automate a way to extract a PDF that gets e-mailed to me daily.  I want to run a script on this PDF, but I cant until I detach it and decode it.

Unfortunately, I have a limitation that prevents me from using any software that is not part of RHELv5.  I cant even install CPAN modules, only modules that Redhat releases as part of v5.4.  I can use custom Perl/Python scripts.

I have successfully taken my /var/spool/user file, chopped off the header/trailer info and decoded the remaining data using 'base64 -d foo' so I know it's not too much harder.  I am just at a loss for a better way to do this within my limited environment.  I do run sendmail on this box, but I am not sure if it can dump attachments without some additional piece of software.  I saw a very nice bit of Perl code in my Googling before asking here, but it required a Perl MIME module that Redhat does not distribute with RHEL.

So, any ideas?  I've seen stuff like 'mpack/munpack' in my Google searches, but I can't seem to find anything like it that comes in 'Official Redhat' RPM.  I unfortunately cannot budge on that requirement.

-Ken




More information about the redhat-list mailing list