procmail
[Top] [All Lists]

RE: How to list all attached files ?

2004-03-05 09:59:28


From: Martynas Buozis
Sent: Thursday, March 04, 2004 2:50 PM

How I can in simple way list all filenames for attachements in email when
there are more than one attachment?

I'd take a look at munpack.

:0
* ^Content-Type:[       ]*multipart/mixed
{

TMPDIR=`mktemp -d munpack-XXXXXX`
TRAP="rm -rf $TMPDIR; $TRAP"

:0
ATTACH_INFO=|munpack -C $TMPDIR -q

#Now, do something with $ATTACH_INFO

}

Here's what ATTACH_INFO might look like:

% munpack -q -C $TMPDIR < dg.txt
munpack: reading from standard input
FredSmith.vcf (text/x-vcard)
Worksheet.xls (application/vnd.ms-excel)

Or you add the -t switch to pull out text parts as well:

% munpack -q -t -C $TMPDIR < dg.txt
munpack: reading from standard input
part1 (text/plain)
FredSmith.vcf (text/x-vcard)
Worksheet.xls (application/vnd.ms-excel)

----

The script above is just a sketch, and hasn't been tested.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>