TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:20406] perl and MIME



Dave Sherohman wrote:
> 
> Anyone know a quick and easy way to extract the structure of a MIME document
> in perl?  I specifically do _not_ want to decode it (all the stuff I've found
> so far assumes that you do).  I just need to make a list that says, "This
> message contains the following files:  a.gif, b.wav, c.jpg."

Try this perl script. It's part of a bigger perl script that I use to
filter my mail. Just give it a mbox as an argument.

$ saveattachments.pl mboxfile

I saves the attachment in /tmp, but I added an unlink line to remove it
since you only want to display the attachments. There probably is an
easier way to do this, but this is some code I had laying around.

You will need perl MIME-tools and MAIL-tools. (And I think
perl-MIME-BASE64)

Clay

saveattachments.pl