home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / mail / misc / 2946 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  4.0 KB

  1. Path: sparky!uunet!wupost!micro-heart-of-gold.mit.edu!eddie.mit.edu!minya!jc
  2. From: jc@minya.UUCP (John Chambers)
  3. Newsgroups: comp.mail.misc
  4. Subject: Re: What is the format of a mailbox file?
  5. Message-ID: <1350@minya.UUCP>
  6. Date: 8 Sep 92 02:47:03 GMT
  7. References: <1992Aug26.203046.25591@murdoch.acc.Virginia.EDU>
  8. Distribution: na
  9. Lines: 70
  10.  
  11. In article <1992Aug26.203046.25591@murdoch.acc.Virginia.EDU>, sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski) writes:
  12. > What is the format of a unix mailbox file and where can the 
  13. > definition be found. ( I didn't see any pointers in the man
  14. > page for 'mail'. )
  15.  
  16. To my knowledge, it isn't documented anywhere. This is is part because
  17. it  depends partly on what flavor of Unix mailer you have.  The "pure"
  18. uucp mailer (which isn't so very pure on most systems these  days  ;-)
  19. had a very simple format back in the old days. A mail file was started
  20. either by the start of the file or by the sequence:
  21.    "\n\nFrom "
  22. Note the two line feeds before the "From", and the SPACE after it. But
  23. as  I've  noted,  there are some variant mailers that do clever things
  24. that shoot down attempts to match on this simple string.  The most fun
  25. are the ones that add their own headers before an existing "\n\nFrom "
  26. byte sequence.
  27.  
  28. > How is the status of new, read, etc. indicated in the file? 
  29.  
  30. What does that mean?  You are clearly talking about some mailer  other
  31. than the usual ones that come with Unix.  The basic Unix mailers don't
  32. add anything but a "From " line to the start of  a  message.   But  of
  33. course lots of add-on mail packages do all sorts of clever things with
  34. their headers.  None of this is very portable.  Well, if you  are  the
  35. sort  that  thinks  that the only mailers that God wants us to use are
  36. the brand X mailers (where X mostly == Internet  in  the  BSD  world),
  37. then  you  probably think that some particular headers are "standard".
  38. You are in for some rude surprises when the Real World starts to  send
  39. you mail.
  40.  
  41. > BTW: the reason for the question is that I need to write a filter
  42. > to split/merge and generally reorganize my mailboxes. If anyone has
  43. > any hints on a good program to do this, I'm listening. And that's why
  44. > I've tacked 'comp.lang.perl' onto the Newsgroups line. I would expect
  45. > someone must have done something like this in Perl, already. 
  46.  
  47. Yup; I've been doing just that. I have a little perl program that does
  48. the  useful  task of chopping up the mailbox into mail files (and only
  49. occasionally mistakes one message for N when some turkey  mailer  adds
  50. headers  with  embedded blank lines followed by a "From" line ;-).  It
  51. looks for interesting (to me) subjects and/or senders, and  does  some
  52. appropriate  (for  me)  things when it gets a match, running vi on all
  53. the files that don't match.  I also have a little perl program that  I
  54. feed the headers via "!}rpl" and it generates headers for a reply. And
  55. so on.  It's fun; everyone should try it.  You rapidly get a real feel
  56. for how truly demented the various mailers out there can be.
  57.  
  58. The most frustrating thing about figuring out how to chop up a mailbox
  59. file is knowing that the mail arrives in separate files, just like you
  60. want it.  The idiots who wrote the mail packages decided to join these
  61. files  into  one big one, eating up lots of cpu time to do so, just so
  62. that you and I would have to write programs to try to reconstruct  the
  63. original  separate files, eating up yet more cpu time.  If they'd just
  64. made the "mailbox" a directory rather than a  file,  they  could  have
  65. delivered  the mail via a link, and no chopping would be necessary.  I
  66. keep getting tempted to write a new mailer that does it this way ...
  67.  
  68. BTW, when it reached here, it didn't have comp.lang.perl anywhere.  So
  69. maybe you should repost it there ...
  70.  
  71. > ======== "If you have a hammer, find a nail" - George Bush,'91  =========
  72.  
  73. The nail that sticks up gets hammered down.
  74.    -- Old Japanese saying.
  75. -- 
  76. All opinions Copyright (c) 1992 by John Chambers. Inquire for licensing at:
  77. 1-617-647-1813 ...!{bu.edu,harvard.edu,eddie.mit.edu,ruby.ora.com}!minya!jc 
  78. --
  79. Pensu tutmonde; agu loke.
  80.