procmail
[Top] [All Lists]

formail -I misunderstanding

1999-01-14 09:06:36
Hi Procmail experts,

I'm using the recipe below to sort the headers of list mail
into predictable order, but when the incoming mail has one
of the elements missing, formail adds an empty one.  The
formail man page says something like: "-I ...If headerfield
consists of only a field name, it effectively deletes the field."

So I'm puzzled; I'd think when it gets:

   `formail ...-I "Reply-to: "...'

that it would ignore it, but obviously, I'm wrong.  Is it the
trailing space?  Anyone have an elegant solution?

I guess I can add trailing recipes to check for blank fields
and delete them, but I'd think there'd be something more clever.

Thanks in advance,
jimo(_at_)eskimo(_dot_)com

#
#General mailing-list cleanup include rc
#
:0 fwh
| formail -k -XFrom -XMessage-Id -XDate -XCc -XTo -XReply-to -XSubject 
-XX-Mailer

#
#Arrange header components to predictable order:
#
:0
{
        FROM=`formail -zxFrom:`
        MID=`formail -zxMessage-ID`
        DATE=`formail -zxDate`
        CC=`formail -zxCc`
        TT=`formail -zxTo`
        RT=`formail -zxReply-to`
        SUBJ=`formail -zxSubject`
        XM=`formail -zxX-Mailer`
        :0 fwh
        | formail \
                        -I "From: $FROM"\
                        -I "Reply-to: $RT"\
                        -I "X-Mailer: $XM"\
                        -I "Message-Id: $MID"\
                        -I "Date: $DATE"\
                        -I "To: $TT"\
                        -I "Cc: $CC"\
                        -I "Subject: $SUBJ"
}

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