procmail
[Top] [All Lists]

Re: Formail question

1995-10-21 12:47:22
Matthew Weed asked,

| I'm using the -D option for Formail.  The problem is that some of my
| messages contain the original Message-ID in the body of the letter and
| not the Header.  Is there an option for Formail to over come this problem?

This is strictly untested; I don't know where in the body the Message-ID's
appear, but if they're at the top of the body, this might help:

      # If there's a Message-Id: in the head, use that one.
      :0hW # `H' is implicit; brackets enclose caret, space, tab
      * ^Message-Id:.*[^        ]
      | formail -D cache_size cache_name
      :0EBbWr # If not but there's one the body, try the one in the body.
      * ^Message-Id:.*[^        ]
      | formail -D cache_size cache_name

You might want to copy a Message-Id: from the body to the head in any case
(if there's none already in the head) just to have it in the right place, so
we could do that first and then formail -D will work normally.  This form
will run formail twice if the Message-Id: header is in the body instead of
the head, but it will look for Message-Id: on *any* line of the body, not
just at the top:

      :0fwh
      * ! H ?? ^Message-Id:.*[^         ]
      * B ?? ^\/Message-Id:.*[^         ]
      | formail -A "$MATCH"

      :0hW
      | formail -D cache_size cache_name

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