Sorry for resurrecting an ancient thread, but I feel this is important
enough to warrant it.

On 2015-05-12 21:50 +1000, Erik Christiansen wrote:

> Heinz, it can all be done in one line of sed, included in the procmail
> rule. This is what I use:
> 
>    :0  
>    * ^TO_luv-main@.*luv.asn.au
>    {   
>                         # We need the subject line _content_, minus 
> [list-name]:
> 
>       SUBJECT=`formail -czX "Subject:" | sed -re "s/Subject:// ; s/ 
> \[luv-[a-z]*\]//g"`
>    
>                         # Header filter leaves body alone:
>       :0fhw
>       | formail -i "Subject: $SUBJECT"
>    
>                         # Delivery, with lockfile:
>       :0: 
>       luv-main
>    }

This could be dangerous, I was just re-reading the procmailrc manpage
and in the BUGS section it says:

       A line buffer of length $LINEBUF is used when processing the
       rcfile, any expansions that don't fit within this limit will be
       truncated and PROCMAIL_OVERFLOW will be set.  If the overflowing
       line is a condition or an action line, then it will be considered
       failed and procmail will continue processing.  If it is a
       variable assignment or recipe start line then procmail will abort
       the entire rcfile.

So, you want to either scrap the SUBJECT variable and stuff the pipeline
literally into the recipe, or add head -c $LINEBUF to the pipeline.
Otherwise an overlong Subject will make procmail bail out and the mail
bounce (best case).

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.

Reply via email to