On Friday, May 24, 2002, at 04:22 , Scott Ding wrote:
> Hi, hola! > I have a perl script to process incoming email on unix > box. When an email comes, the system pipes all the > contents of the message to the script. my premise here is something on the order of the .forward trick "| myPerlMailParser" > I have no > problem to let the script processes text based > messages. > But if there is a zip file as an attachment > in the email, how Perl can reconize it as a zip file > and save it to a file before calling unzip and > processing it? what you want to look at is something on the order of Mail::Message::Body::Multipart cf: http://search.cpan.org/search?module=Mail::Box cf also: Mail::Message::Convert basically you concern is two fold: a) in the header you will want to catch a line like: # Content-Type: multipart/mixed; boundary=Apple-Mail-1--1068334470 b) at which point you would be looking for the block # --Apple-Mail-1--1068334470\n # Content-Disposition: attachment;\n # \tfilename=cgi2_examples.tar.gz\n # Content-Transfer-Encoding: base64\n # Content-Type: application/x-gzip;\n # \tx-unix-mode=0644;\n # \tname="cgi2_examples.tar.gz"\n c) after that it is all 'gunk' of the form: #H4sIAD6VyTkAA+w9a1fbSLLz2b+io5CNSQBh89oF4xmDTeIzgH2NSSY3JDpCamNtZMnRA8IOzG/ f Assuming that you just 'saved as is' to some place, then you could 'post process' this email..... When I started cutting webBots - before I 'groked libwww-perl' - I ran into the fact that parsing that stuff can be way too much out of hand... since I had to go to sysread/syswrite to do the 'download compressed tar files' to an alternative location... You may wish to leave that heavy lifting to the above mentioned section.... My recommendation of course is to take your filter out, attach a known compressed tarball and mail it to yourself - save the whole file off, and play with it a bit.... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]