From kde-devel Tue Mar 07 23:57:00 2000 From: Rik Hemsley Date: Tue, 07 Mar 2000 23:57:00 +0000 To: kde-devel Subject: Re: Kmail,mail formats--some assistance needed X-MARC-Message: https://marc.info/?l=kde-devel&m=95247685626490 #if mh > Hi, > thanks Roberto + Rik. > Actually my problem was, that my app let's the user choose the mail > folder. I thought, there's an easy way to check whether this folder > really contains mail files by just checking the index files. > After reading your mails, it seems that I have to check every file > in the folder whether it contains mails or not... what brings up the > next question: Is there a reliable way to do this? > Looking for "From " isn't reliable, since every text file can contain > this word !? (I guess I have to live with this problem) You can make a pretty good guess, but you can't be sure. mbox format spool are theoretically supposed to start with 'From ', but then some clients stupidly insert blank space before this. This is probably an accident that happens when they 'purge' it. If you look at /usr/lib/magic (or whereever it's stored on your system) you'll find the way file(1) does it. # Unfortunately, saved netnews also has From line added in some news # software. #0 string From mail text Haha, looks like looking for 'From ' is unreliable. > > > Did I mention mbox corrupts your mail ? :) > > Aha, is this the reason why I sometimes find empty mails dated to 1976 > or 2004 in my mailfolder? (I always blamed it on Kmail) Possibly. Though I'd guess that's the client's fault. I don't want to go into the problems with mbox all over again on a public list, but you if you look in KDE's CVS at kdepim/empath/design_docs/locking.html you can read a discussion about locking that IMO gives a solid argument for the death of mbox, MMDF and MH format mail spools. There are other reasons that aren't mentioned in that document, such as the way your mail's body has to be edited to store it if it contains a line beginning with 'From '. Rik -- Share nothing with strangers but an obsession with celebrities.