The Thursday 2004-10-21 at 10:28 -0500, Danny Sauer wrote:
The code in question is:
open(STDIN,"+<$folder") || die "Error: opening input folder $folder\n"; if (!lock(STDIN)) { close(STDIN); printf STDERR "Error: could not lock folder $folder\n"; }
What? Why would this fellow reopen STDIN anyway? The filehandle is only used in one place - the while loop that reads the contents in - and it's explicitly specified in there. It's not like the code takes advantage of the special features of STDIN, like the ability to just say <> rather than <STDIN>.
I have no idea O:-) Once uppon a time, I did program for a living, in dos/win3.11; never touched linux nor unix. And certainly not in perl ;-) The error seems to be with "lock" - if I coment that "if" sentence, it works. I assume it wants locks stdin because new mail might try enter the mailbox... I don't know, it makes more sense to me to lock a standard file, not stdin. But I have not tried yet even to analyze the program, but as I don't even know what things like "+<$folder" means in perl...
Anyway, you should probably replace STDIN with something that makes more sense anyway, like, perhaps FOLDER_HANDLE. Just a global search and replace oughtta do it. Why is it so hard for people to use reasonable variable names? And why is it so difficult for me to stay on-topic on this list? :)
I guess there is a programming list somewhere - but I haven't tried, I'm too rusty :-)
Message 5 has only one part (the message body), and no attachments.
That's probably because there's only one part, and the content type is weird. Full headers would help, but in those, you really just need to parse the mbox (or run through a filter before delivering to the mbox) to separate the messages, then look for the first blank line. That'll be the division between the headers and body. The body then just needs decoded and saved.
Yes, I remember. As I mentioned, time ago I did a program in pascal to
delete attachments, but I lost it. That was before receiving these
problematic emails - they would fail anyway in my coding.
I was hoping somebody else had done it before. Have a look at one of
those emails - the important part, anyway:
|Message-ID:
That should be a pretty simple exercise, I'd think, given some programming skillz. There are perl modules to deal with that, too. I'm not sure why that program doesn't just use one of those, but then, the whole program is structured a bit poorly, IMHO.
I could easily - I think ;-) - write a program to remove the "attachment" there - but I would be at a loss on how to add a plain text instead (there is no text part), and also how to produce the file to save it.
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:-) -- Cheers, Carlos Robinson