[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stripping email attachments ???



Am 20.05.2003 um 16:33 schrieb Michael D. Schleif:

> I want to be able to _strip_ a copy of these attachments and place the
> attachments under a web server directory, where I can retrieve and
> see/listen to them from just about any computer in front of which I find
> myself ;>
> [..]
> What do you think?
 
I think, it might work with a little perl script:

----snip---------------------------
#!/usr/bin/perl

use strict;
use MIME::Parser;
use Date::Format;

my $datadir = '/home/user/~public_html/';
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;
----snip---------------------------

Save this script as ~/bin/demime e.g. Then pipe your mail into this
script from your procmailrc 

:0
| ~/bin/demime

Regards, 
Dennis



Reply to: