From owner-freebsd-questions@FreeBSD.ORG Sat May 30 08:24:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0BD21065695 for ; Sat, 30 May 2009 08:24:38 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from mail.optimis.net (mail.optimis.net [69.104.191.124]) by mx1.freebsd.org (Postfix) with ESMTP id 905F28FC13 for ; Sat, 30 May 2009 08:24:38 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (marvin.optimis.net [192.168.1.3]) by mail.optimis.net (8.14.3/8.14.2) with ESMTP id n4U7udr4021342 for ; Sat, 30 May 2009 00:56:39 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (localhost [127.0.0.1]) by marvin.optimis.net (8.14.3/8.14.2) with ESMTP id n4U7udgV072257 for ; Sat, 30 May 2009 00:56:39 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: (from george@localhost) by marvin.optimis.net (8.14.3/8.14.2/Submit) id n4U7udSw072256 for freebsd-questions@freebsd.org; Sat, 30 May 2009 00:56:39 -0700 (PDT) (envelope-from freebsd@optimis.net) Date: Sat, 30 May 2009 00:56:39 -0700 From: George Davidovich To: freebsd-questions@freebsd.org Message-ID: <20090530075639.GA71434@marvin.optimis.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: MIME attachments in mbox files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 08:24:39 -0000 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: > 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