procmail
[Top] [All Lists]

mime-decode.rc

1997-05-28 08:36:00
Here's a file from my procmaillib.  For a recent project I needed to
decode whatever standard MIME encoding the body was in, including this
file does that.

# $Id: mime-decode.rc,v 1.2 1997-05-28 10:42:53-04 roderick Exp $
#
# Roderick Schertler <roderick(_at_)argon(_dot_)org>

# Undo the Content-Transfer-Encoding.

:0
* ^Content-Transfer-Encoding
{
    mime_decode_encoding = `formail -zx Content-Transfer-Encoding`

    :0 fbrw
    * mime_decode_encoding ?? ^^quoted-printable^^
    # grr, beware, you can't bundle the switches
    | mimencode -q -u

    :0 afhw
    | formail -i 'Content-Transfer-Encoding: 8bit'

    :0 Efbrw
    * mime_decode_encoding ?? ^^base64^^
    | mimencode -u

    :0 afhw
    | formail -i 'Content-Transfer-Encoding: binary'

    mime_decode_encoding
}

-- 
Roderick Schertler
roderick(_at_)argon(_dot_)org

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