MIME attachments in mbox files
smithi at nimnet.asn.au
Sat May 30 12:24:34 UTC 2009
On Fri, 29 May 2009 23:40:52 -0400 Vince Sabio <vince at 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?
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.
More information about the freebsd-questions