Re: Extract Attachment from Mail



Cameron Simpson wrote:
On 12Feb2007 07:27, Patrick Steiner <patrick.steiner@xxxxxx> wrote:
| i fetch my mails via fetchmail and after that procmail sorts them into | different mailbox-folders.

"mail" is its own plural, like "sheep" or "fish".

| how can i extract attachments and but them into a folder like | ~/attachments? i tried mimeStrip.pl, but
| i also get some non -base64 coded mails and the don't work with this | tool :-(. any ideas who i can extract
| this files?

I extract attachments using the metamail package (not available as a
Fedora package as far as I can tell - had to build it from source; I can
email you a tarball if you like).

I use a wrapper script to put the files somewhere
useful:

http://www.cskk.ezoshosting.com/cs/css/bin/mailunpack

That script relies on a bunch of other things from that script collection.
You might just want to skip it for the metamail incantation. If you want to
take it as-is, it may be easiest to just grab the whole css package:

http://www.cskk.ezoshosting.com/cs/css/

I normally run this script from mutt but it could easily be used from a
procmail recipe.

Disclaimer: I wrote these scripts and thus am a bit biased.


You can do it in a few lines of perl with the MIME::Parser package (from CPAN, I don't think it is rpm-packaged). Something like this:


#Accept a mail message on stdin, split attachments into
# directory
use MIME::Parser;
### Create parser, and set some parsing options:
$archive='/path/for/attachments';
my $parser = new MIME::Parser;
### Change how nameless message-component files are named:
$parser->output_dir("$archive");
$parser->output_prefix('msg');
### Parse input:
$entity = $parser->parse(\*STDIN) or die "parse failed\n";



--
Les Mikesell
lesmikesell@xxxxxxxxx

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: Extract Attachment from Mail
    ... | i fetch my mails via fetchmail and after that procmail sorts them into ... I extract attachments using the metamail package (not available as a ... That script relies on a bunch of other things from that script collection. ...
    (Fedora)
  • Re: [PHP] limiting the amount of emails sent at a time in a batch send
    ... I want to limit these script two send 100 email and then pause for a few ... all the emails that are dated for today. ... I am using swift ... used for many unique mails. ...
    (php.general)
  • Re: Cannot print in OE6 both news and mail
    ... > Recently I found out that I cannot print out any mails or news from ... > Do you want to continue running the script on this page? ... > printer driver and paper port sw for scanner. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: [PHP] limiting the amount of emails sent at a time in a batch send
    ... all the emails that are dated for today. ... I am using swift ... This is a rough example taken from my own script. ... I can't remember if AntiFlood can be used for many unique mails. ...
    (php.general)
  • Re: K3B for backups
    ... can walk away with all your data with, or without, using this script. ... popup. ... OK, unlikely that a backup would be happening that way, although you ... Or just his mails, ...
    (alt.os.linux.suse)