procmail
[Top] [All Lists]

Re: Splitting digests with procmail and formail

1996-08-16 15:07:24

Hmm ... when I replace my recipe with 

:0
* ^Subject: +CONVOCATION-L.*
{
  # First split and file the mail
  :0c:convocation.lock
  | formail +1 -i "Reply-To: 
convocation-l(_at_)oracle(_dot_)wizards(_dot_)com" -ds >>$MAILDIR/convocation

  # Next, replace the digest with the first message
  # and then deliver normally
  :0f
  | formail -eYd -1 -s >>$DEFAULT
  #----------------------^^^^^^^^
}

the presence of the '>>$DEFAULT' causes the appropriate first message
to appear in my mailbox, just the way I want it, along with the full
message!  So now all I need to do is to suppress delivery of the
original message and I'm home free!

Hmm.  I think the second formail recipe needs the "i" flag, since the
formail will stop splitting the digest at the first one, and exit, while
procmail is still trying to feed a probably large mail into the pipe
(which will error because formail has already finished).

Anyway, I see two ways to do this: 
(1) replace the burst digest with the first message of it, and then
    deliver the replaced mail, or 
(2) make the second formail a "delivering" recipe,

1:  # replace incoming digest (already burst) with first message (summary)
    :0fi
    | formail -eYd -1 -s

    # Now deliver the single digest message
    :0:
    $DEFAULT

2:  # deliver the digest summary explicitly
    # second formail recipe (with locking for delivery)
    :0:
    | formail -eYd -1 -s >>$DEFAULT


Try the (1) method first, since, procmail does the I/O to the $DEFAULT
mail directory itself, and therefore will use the appropriate and
correct locking methods.  Method (2) uses the shell to do the I/O and
the only locking protection is by "dot-locking", which may be
insufficient if other programs are reading/writing the maildrop at
$DEFAULT.

Alan

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