[SlugBug] Parsing attachments from emails
Bill Best
bill.best at commedia.org.uk
Wed Jun 7 20:30:48 BST 2006
hi all
i am looking to quickly write a script (by tomorrow night) to remove an
attachment from an email and direct the attachment to a folder.
this is with particular regard to creating a primitive vlogging script
that removes .mp4 video attachments sent from my mobile phone and
delivers them to a media streaming server.
i have tried using this in .procmailrc
> :0
> * ^Subject: video
> | munpack -q -C /path/to/directory/
but that has not yet worked so far.
i have discovered some useful info here as to how to roll your own
script in Perl:
http://www.monkeyhelper.com/2006/02/roll_your_own_flickrpoddr_or_v.html
but knowing no Perl i am at an obvious disadvantage.
i have created a Perl script as suggested thus:
> use MMS::Mail::Parser;
> my $mms = MMS::Mail::Parser->new();
> my $message = $mms->parse(\*STDIN);
> if (defined($message)) {
> my $parsed = $mms->provider_parse;
> print $parsed->header_subject."\n";
> print $parsed->body_text."\n";
> } else {
> print STDERR "Invalid message\n";
> }
which pipes its output to STDOUT. i have called the script mmsparser.pl
and i now have this in .procmailrc
> :0:
> * ^Subject: video
> |/some/dir/mmsparser.pl > /path/to/directory/
but no joy so far.
has anyone any better ideas or suggestions?
many thanks in advance as ever.
bill
More information about the SlugBug
mailing list