MIME attachments in mbox files
    George Davidovich 
    freebsd at optimis.net
       
    Sat May 30 08:24:39 UTC 2009
    
    
  
On Fri, May 29, 2009 at 11:40:52PM -0400, Vince Sabio wrote:
> I have a need (well, I have lots of needs, but I'll try to stay
> focused here) 
Given the nature of most messages in the last few days, I'd suggest
you're trying too hard.  ;-)
> to be able to take a Windows zip file that is stored as a MIME
> attachment to an e-mail message in an Mbox-format spool file, and
> unzip the attachment. I actually need to script the process. In case
> it helps, I can dedicate a mailbox to the task. 
> 
> Anyone know of any FreeBSD utility(ies) that do(es) this?
Generally, when you're talking about processing an mbox and doing
something with message bodies, you're looking at formail plus procmail
in combination with a tool that can interpret the mime structure and
process the components (mimedefang, demine, stripmime, mimedecode,
reformime, renattach, etc.).  That's a roundabout way of saying, no,
there are no FreeBSD utilities to do what you want, but there's lots to
be found in ports.
I'd start with a quick read through of some of those manpages, but at
first glance, ripmime alone might do the trick:
<http://www.freebsd.org/cgi/man.cgi?query=ripmime&apropos=0&sektion=0&manpath=FreeBSD+7.2-RELEASE+and+Ports&format=ascii>
> If necessary, I can write my own parser to strip out the attachment,
> in which case I'd need only a widget that can take in a MIME (base64)
> encoded zip file, convert it to binary, and unzip it.
In that case, and assuming you're using Perl, MIME::base64 and
IO::Uncompress::Unzip (or /usr/ports/archivers/unzip) is what you want.
Bonus points for writing a one-liner.
-- 
George
    
    
More information about the freebsd-questions
mailing list