procmail
[Top] [All Lists]

Trouble with pm-jamime-decode.rc,v 1.2 1998/03/30 09:49:09

2000-02-15 08:41:20
Hello Folks,

        I found that pm-jamime-decode.rc does not decode
quoted-printable if it is only in the body of the message,  In this
case, in the header we only get something of the sort:

Content-Type: multipart/mixed; 
boundary="1581342828(_dot_)949434865171(_dot_)JavaMail(_dot_)root(_at_)ecircle4"

I modified pm-jamime-decode.rc so as to check also in the body for
$JA_MIME_DECODE_REGEXP.  Unfortunately, now it does not find the

^Content-Transfer-Encoding: *quoted-printable

that is also in the body.  I do not see why this now fails after the
above is found in the body.  My modified pm-jamime-decode.rc as well
as a real piece of e-mail that the current pm-jamime-decode.rc does
not decode.

By the way, I suggest that the default value of $JA_MIME_DECODE_REGEXP
be changed from "^Content-Type: *text/plain" to 
"^Content-Type: *text/(plain|enriched)".

Thanks folks,

        --Ralph

# @(#) pm-jamime-decode.rc -- decode MIME body contents; quoted-printable, 
base64
# @(#) $Id: pm-jamime-decode.rc,v 1.2 1998/03/30 09:49:09 jaalto Exp $
#
#   File id
#
#       .Copyright (C)  1998 Jari Aalto
#       .$Maintainer:   Jari Aalto <jari(_dot_)aalto(_at_)poboxes(_dot_)com> $
#       .$Created:      1998-01 $
#       .$Keywords:     procmail recipe $
#
#       This code is free software in terms of GNU Gen. pub. Lic. v2 or later
#       You can get newest version by sending email to maintainer with
#       subject "send <FILENAME>"
#
#   Documentation
#
#       The original father of the decoding scheme used here was
#       presented by Peter Galbraith 
<galbraith(_at_)mixing(_dot_)qc(_dot_)dfo(_dot_)ca> in
#       procmail mailing list somewhere at the end of 1997.
#
#       This includerc supposes that the header has MIME header
#       Content-Type: text/plain and performs qp or base64 decoding
#       on the whole message. Note, that if you receive messages that
#       have many mime attachements, then this recipe is not suitable
#       for it.
#
#       Procmail is not designed to handle mime attachements and this
#       recipe only applies to whole _body_.
#
#   Required settings
#
#       PMSRC must point to source direcry of procmail code. This subroutine
#       will include
#
#       o   pm-javar.rc
#
#   Call arguments (variables to set before calling)
#
#       (none)
#
#   Return values
#
#       (none)
#
#   Examples
#
#       Instead of testing the existense of text/plain in the body,
#       you can force decoding by settings JA_MIME_DECODE_REGEXP to
#       ".*".
#
#           RC_MIME_DECODE = $PMSRC/pm-jamime-decode.rc
#
#           :0
#           * condition
#           { JA_MIME_DECODE_REGEXP = ".*" }
#
#           INCLUDERC = $RC_MIME_DECODE     # call subroutine.
#
#
#   Change Log (none)

# .................................................... &initialising ...

dummy = "init: pm-jamime-decode.rc Reading variable definitions if needed"

# :0
# * !  WSPC ?? ( )
# { INCLUDERC = $PMSRC/pm-javar.rc }

# .......................................................... &public ...
# User configurable sections

JA_MIME_DECODE_REGEXP = ${JA_MIME_DECODE_REGEXP:-\
"^Content-Type: *text/plain"}

# ........................................................... &do-it ...
#   Run conversion if it was quoted printable.
#   Also reflect correct MIME header

dummy = "pm-jamime-decode.rc: handle quoted printable"

#   Prevent calling sh -c here. This speeds up procmail
#
jaMimeDecodeShellmetas = $SHELLMETAS
SHELLMETAS


:0
*$ $JA_MIME_DECODE_REGEXP
{
    :0 fbw
    * ^Content-Transfer-Encoding: *quoted-printable
    | $MIME_BIN_QP

        :0 Afhw
        | $FORMAIL -I "Content-Transfer-Encoding: 8bit"

    :0 fbw
    * ^Content-Transfer-Encoding: *base64
    | $MIME_BIN_64

        :0 Afhw
        | $FORMAIL -I "Content-Transfer-Encoding: 8bit"
}

:0 EB
*$ $JA_MIME_DECODE_REGEXP
{
    :0 fbw
    * ^Content-Transfer-Encoding: *quoted-printable
    | $MIME_BIN_QP

        :0 Afhw
        | $FORMAIL -I "Content-Transfer-Encoding: 8bit"

    :0 fbw
    * ^Content-Transfer-Encoding: *base64
    | $MIME_BIN_64

        :0 Afhw
        | $FORMAIL -I "Content-Transfer-Encoding: 8bit"
}

SHELLMETAS  = $jaMimeDecodeShellmetas
dummy       = "subroutine: pm-jamime-decode.rc end."


# End of file pm-jamime-decode.rc
--- Begin Message ---
Hallo !

Ich habe am Wochenende aus Flohmarkbeständen diverse Ausgaben des "Amtsblatt
des Königl. Konsistoriums der Provinz Pommern" der Jahre 1889-1891 und
1896-1897 erworben. Die Jahrgänge enthalten einen Namensindex der erwähnten
Personen und es handelt sich bei den Einträgen ausschliesslich um Angaben zu
irgendwelchen kirchlichen Bediensteten, wie Ernennungen zum
Superintendenten, Berufung zum Pastor, verstorbene Pastoren ..o.ä. für die
Provinz Pommern. Falls also irgend jemand etwas über einen Pastor in Pommern
in der Zeit sucht, sehe ich gern mal nach.

Guido Conell
www.conell.de



--- End Message ---
<Prev in Thread] Current Thread [Next in Thread>