The Saturday 2004-10-23 at 01:53 +0200, Carlos E. R. wrote:
The Thursday 2004-10-21 at 10:28 -0500, Danny Sauer wrote:
Note, I posted some code on Aug 10 this year, under the subject "Re: [SLE] KMail question" which will pull the attachments out of messages fed in one at a time. It's a bit more compact and would require some modification for your use, though if you're happy with the somewhat questionable code you're running, that's not too relevent. :)
Aha, I've just found it. Interesting... I could perhaps trigger it from procmail, and bouncing a copy of those email (from Pine) would perhaps do the trick. Or even use kmail for a while...
Er... is there a quick-perl-get-started-howto? O:-)
I'm trying to use your code. I call it thus: formail -s stripattach < mbox_file. But it complains that "Can't locate Email/MIME.pm ". You did mention that: |> You'll have to install Email::MIME and |> Email::MIME::Attachment::Stripper from CPAN. So, I start downloading things from CPAN (actually, from a mirror at perl.com you mentioned). I download Email-MIME-1.8.tar.gz and try to install it - I'm lazy, I use mc (midnight comander) and a click on the Makefile.PL starts it; of course, more complaints: Warning: prerequisite Email::MIME::ContentType 1 not found. Warning: prerequisite Email::MIME::Encodings 1 not found. Warning: prerequisite Email::Simple 1.7 not found. Warning: prerequisite MIME::Types 0 not found. Ok, MIME::Types comes in perl-MIME-Types...rpm from SuSE. One thing less. Email-Simple-1.91.tar.gz gives no problems, installed. Fantastic. Well, one, checkinstall fails... it makes bad rpms. Forget checkinstall. Email-MIME-Encodings-1.3.tar.gz - now, this one is different; I get: Warning: prerequisite MIME::Base64 3.05 not found. We have 2.21. Warning: prerequisite MIME::QuotedPrint 3.03 not found. We have 2.21. Now, that is a problem. The versions Email-MIME-Encodings-1.3 wants are newer from those that SuSE 9.1 has got installed. If I install those versions, then they will want other modules updated... it will be a neverendinghistory :-( So, I say, I may install an older version of Email-MIME-Encodings; right, Email-MIME-Encodings-1.1.tar.gz installs nicely. Then Email-MIME-1.8.tar.gz, and finally Email-MIME-Attachment-Stripper-1.3.tar.gz. Done. Now, test your code [...] ¡It works! :-) Well, it doesn't put a text saying that the file was removed. Probably I can live with that, at least for the set of mails I want to handle. Some of the files have repeated names... now, that is a problem. I could prepend, for example, the email date :-? So, I add the line: my $from_header = $mail_parsed->header("Date"); But the date is in the format. "Fri, 24 Jan 2003 10:32:04 +0100". I would need to modify it to something like an ISO date: 2004-01-24 ¿Is that doable? I suppose there are ready made functions for that kind of string manipulation, but I don't even know how can I browse an index of all functions (modules) available, preferably in hierarchical sort. Yes, "info perl" says to look at "perlintro", but I get "not found". There is only "perldoc", which assumes I already know what module I want to look at. Mmmm.... there is a "man perlintro". Is that it? Not a browsable help? Pfff. :-( -- Cheers, Carlos Robinson