Re: howto autosave email attachments?
Johannes Wiedersich wrote:
> We have a shiny new printer/copier/scanner. It sends scanned pages as email
> attachments. Instead of manually selecting individual email adresses on the
> cumbersome telephone-like local keyboard, it would be handy to mail all of
> them to the same e-mail address and have the attachments automatically
> extracted and saved on a network share of the email server.
> The idea is to have a special user 'scanner'. All email attachments of any
> mail to this user are saved to /folder/for/scans and email deleted.
> How would this be done?
For example with a perl script to which you pipe the messages with
"procmail" or "maildrop":
$ cat ~/bin/mail-archiver
my $datadir = '/tmp';
my @lt = localtime(time);
my $date = strftime("%Y%m%d-%k%M", @lt);
my $parser = new MIME::Parser;
system('mkdir -p '.$datadir.'/'.$date);
my $entity = $parser->parse(\*STDIN) or die;