Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2009 22:03:16 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        Vince Sabio <vince@vjs.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: MIME attachments in mbox files
Message-ID:  <20090530212836.I55023@sola.nimnet.asn.au>
In-Reply-To: <20090530082027.3E0FE1065686@hub.freebsd.org>
References:  <20090530082027.3E0FE1065686@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 29 May 2009 23:40:52 -0400 Vince Sabio <vince@vjs.org> wrote:

 > I have a need (well, I have lots of needs, but I'll try to stay 
 > focused here) 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. 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.
 > 
 > Anyone know of any FreeBSD utility(ies) that do(es) this?

/usr/ports/converters/mpack
/usr/ports/archivers/unzip

You could first export/save each such message to a separate file and run 
munpack(1) on it to extract any base64 attachment/s, then unzip(1) any 
identifiable zipfiles.  You can most likely rely on the return code from 
'unzip -t $file' to check any files are valid zipfiles, if munpack can't 
recover the original filename from the MIME headers.

cheers, Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090530212836.I55023>