procmail
[Top] [All Lists]

Re: Mail folder formats..

1999-09-21 01:14:57
On Mon, 20 Sep 1999 23:02:14 -0500, Philip Guenther 
<guenther(_at_)gac(_dot_)edu>
wrote:
Umar Goldeli <umar(_at_)atlas(_dot_)synflux(_dot_)com(_dot_)au> writes:
The problem is that the folder is not in standard format.. :( i.e.
the message delimeter is usually "\n\nFrom:" isn't it? Because the
mail file doesn't appear to have that delimeter..

Um, the separator is not really a separator. A message begins with the
word "From " at beginning of line; it's not a separator, but the
beginning of the message. This is not to be confused with the regular
"From:" header (notice the colon). There's a bit of an elaboration on
this in the FAQ; <http://www.iki.fi/era/procmail/mini-faq.html>

Is there an option that will allow me to do that within the script?
You can do it from the rcfile by filtering the header through formail:
     # If there isn't a From_ line, use formail to add one
     :0 fhw
     * ^^From ()
     |formail
That would go before the recipes that deliver to mbox folders.

Um, do you mean

    # If there isn't a From_ line, use formail to add one
    :0 fhw
    * ! ^^From ()
    | formail

("When the comments disagree with the code, both are probably wrong" :^)

Alternatively, you can fix up the format at delivery time:
     # Force mbox format via formail as we deliver
     :0 w:
     |formail >>mailfolder

This is clumsy in the sense that you have to do it for each delivery,
but in Umar's situation, there will be about one delivery per rc file
anyway if I understand the explanation.

** The filtering method has a slight advantage over the doing the fixup
at delivery time if the user that procmail is running as could be close
to its disk quota or if the disk might fill up.  When procmail does a
delivery to a mbox-style folder, if the delivery fails part way through
then procmail will truncate the mailbox back to its original size before
considering the delivery a failure.

That too. Good point.

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

<Prev in Thread] Current Thread [Next in Thread>