procmail
[Top] [All Lists]

Re: formail question

1997-07-14 22:25:00
Zhiliang Hu <hu(_at_)superprism(_dot_)net> writes:
However, due to various difficulties to get quick help from sys-admin, I 
could not install METAMAIL, nor recompile elm.

Ah well, it was worth a try.


The reason why I came to "strip" that paticular line was, I tested 
mannually which line in the header cause my elm to "jam" on SOME mails 
and subsequently picked up that "charset=iso-8859-1" thing (when the line 
removed, elm reads the mail fine :) So I came to the idea to use formail 
...

Acturally I am more interested in the procmail recipe in general: how an 
action like this shall be passed to the rest recipes in procmailrc?

You use a filter (a recipe with the 'f' flag) to do it.

Actually, I have to confess: I currently do this myself.  In my case
it's because I haven't had the time to track down why MH thinks it
needs to fire up mhn (the MIME handling part of MH) only on some
messages that have a charset of iso-8859-1, but not others.  Rather
than track that part of the MH source code (now *that's* ugly code.
Too many people have played with it...), I instead just added (almost)
the following recipe to my .procmailrc:

    :0
    * ^Content-Type: *\/text/(plain|enriched).*
    {
        # First, delete the charset if it's 'normal'.
        :0
        * MATCH ?? charset="?(iso-8859-1|us-ascii)"?
        {
            # We need perl for this...
            :0 chiw
            CT=|perl -e "\$_='$MATCH';" \
                     -e 's:;\s*charset="?(iso-8859-1|us-ascii)"?::i;print'
            :0 fah
            |formail -i"Content-Type: $CT"
        }

        # Then, remove the MIME headers totally if this is just plain text
        # in the standard charset.
        :0 fhw
        * ! ^Content-Type:.*;
        |formail -I"Content-Type" -I"MIME-Version:"
    }


That may work for you, assuming you have perl availible.

However, I still recommend fixing elm or metamail if you can bug
someone into (eventually) doing it, as the above wins no style points
and doesn't solve the problem for all the other people on the system.

(I don't _think_ this qualifies me as a hypocrite.  But then again
'hypocrite' is one of those labels which no human will believe him or
herself to wear while there exists (in his or her mind) an alternate
explanation for their actions...)

Philip Guenther

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