Re: MIME attachments in mbox files
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=ripmimeapropos=0sektion=0manpath=FreeBSD+7.2-RELEASE+and+Portsformat=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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: MIME attachments in mbox files
On Fri, 29 May 2009 23:40:52 -0400 Vince Sabio vi...@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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: MIME attachments in mbox files
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? i'm not sure if i understand well what you want, but install metamail package from ports. there is here program that can just extract all attachments to files. then you can unzip ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: MIME attachments in mbox files
** At 00:56 -0700 on 05/30/2009, George Davidovich wrote: 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. ;-) Yeah, I was considering leading with an apology for the on-topic post. g 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. Sorry, I misspoke: sed 's/utilities/ports/g' 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=ripmimeapropos=0sektion=0manpath=FreeBSD+7.2-RELEASE+and+Portsformat=ascii This, and Ian's munpack suggestion, will both do what I need -- but with one [very minor] exception: There is no way to override the file name specified in the MIME header (if present, which, in my case, it typically will be) and force it to use a specific output file name. Or just send the output to stdout, so I can redirect it to a file name of my choice (or to unzip). Not a show stopper by any means, just requires a workaround. I suspect that the authors of these utilities (there I go again) expected they would be invoked interactively. 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. Using C, but shelling out where necessary to get stuff done. It looks like {ripmime, munpack} and unzip will do the trick. Many thanks for the pointers. I now return you to your regularly scheduled META discussion(s)... :-) __ Vince Sabio vi...@vjs.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
MIME attachments in mbox files
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? __ Vince Sabio vi...@vjs.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org