Am 05.11.2003 um 16:44 schrieb Adam Galant: > > > I need a script to extract all attachments from emails and do an action an > > > each of them (scp to a different machine). How to do this? > > > > As they are passing through the MTA, or are they statically sitting > > somewhere? > > Yes, messages come directly from MTA. I know procmail is my friend here > ;-) but I still don't know how to handle attachments here. A quick recipee > will be of great help.
Perl is your friend here ;-) This little script will save all mails decoded in ~/tmp. #!/usr/bin/perl use strict; use MIME::Parser; use Date::Format; my $datadir = '/home/user/tmp'; my @lt = localtime(time); my $date = strftime("%Y%m%d-%k%M", @lt); my $parser = new MIME::Parser; system('mkdir -p '.$datadir.'/'.$date); $parser->output_dir($datadir.'/'.$date); my $entity = $parser->parse(\*STDIN) or die; Regards, Dennis -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]