Hi Martin,
Thank you for your last e-mail with Per Hedeland's RFC 2047
header demangler perl script. I have decided to make use of it since
it does all headers, instead of just Subject and From. I have been
going through some of my e-mail and find that virtually *all* headers
can have RFC 2047 encoded in it.
So here is my latest version of my filter. For the moment, I just
commented out my old Subject and From code.
Regards,
--Ralph
Dr. Ralph P. Sobek Disclaimer: The above ruminations are my own.
Ralph(_dot_)Sobek(_at_)irit(_dot_)fr
sobek(_at_)irit(_dot_)fr
http://beeline.to/genealogy/
Ph:(+33)[0]561558618 FAX:(+33)[0]561556258 http://www.irit.fr/~Ralph.Sobek/
===============================================================================
Estimates are that one-third to two-thirds of animal and plant species will
disappear in forseeable future! AWFUL!
# @(#) pm-mime-decode.rc -- decode MIME body contents; quoted-printable, base64
# @(#) $Id: pm-mime-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
# 00/03/24 - RpS: Adapted from Jari Alto's pm-jamime-decode, handles
# encoded Subject and From headers, as well as multipart with only ONE
# part.
# 00/03/30 - RpS: Allowed for multiple =?iso-8859-[1-9]?Q?.*?=
# fields. Also eliminated QP embedded CRs and LFs in Subject and From
# headers.
# 00/04/07 - RpS: Found new variation, all low-caps: =?iso-8859-1?q?.*?=
# 00/04/10 - RpS: Added use of Per Hedeland's
<sendmail+per(_at_)Sendmail(_dot_)ORG>
# perl script RFC 2047 header De-mangler (dmmc), since it does entire
# header on one swoop.
# .................................................... &initialising ...
dummy = "init: pm-mime-decode.rc Reading variable definitions if needed"
SHELL=/bin/sh
# :0
# * ! WSPC ?? ( )
# { INCLUDERC = $PMSRC/pm-javar.rc }
:0
* ! MIME_VER ?? [0-9]
{
INCLUDERC = $PMSRC/pm-jamime.rc
}
# .......................................................... &public ...
# User configurable sections
JA_MIME_DECODE_REGEXP = ${JA_MIME_DECODE_REGEXP:-\
"^Content-Type: *text/(plain|enriched)"}
# ........................................................... &do-it ...
# Run conversion if it was quoted printable.
# Also reflect correct MIME header
dummy = "pm-mime-decode.rc: handle quoted printable"
# Prevent calling sh -c here. This speeds up procmail
#
jaMimeDecodeShellmetas = $SHELLMETAS
SHELLMETAS
# De-mangle RFC 2047 header mangling
:0Hhfw
* =\?[^?]+\?[qb]\?[^?]+\?=
| $HOME/bin/dmmh
#:0 D
#* ^Subject:\/.*=\?iso-?8859.*\?=.*
#{
# SUBJECT = $MATCH
# clean_Subject = `echo "$SUBJECT" | \
# sed -e 's/=?iso-\{0,1\}8859-[1-9]?[QqB]?\([^?]*\)?=/\1/g' \
# -e 's/=0D//g' -e 's/=0A//g' | \
# $MIME_BIN_QP `
# SUBJECT_DO_IT = "yes"
#}
#
#:0 ED
#* ^Subject:\/.*=\?ISO-?8859.*\?=.*
#{
# SUBJECT = $MATCH
# clean_Subject = `echo "$SUBJECT" | \
# sed -e 's/=?ISO-\{0,1\}8859-[1-9]?[QqB]?\([^?]*\)?=/\1/g' \
# -e 's/=0D//g' -e 's/=0A//g' | \
# $MIME_BIN_QP `
# SUBJECT_DO_IT = "yes"
#}
#
#:0 D
#* ^From:\/.*=\?iso-?8859.*\?=.*
#{
# FROM = $MATCH
# clean_From = `echo "$FROM" | \
# sed -e 's/=?iso-\{0,1\}8859-[1-9]?[QqB]?\([^?]*\)?=/\1/g' \
# -e 's/=0D//g' -e 's/=0A//g' | \
# $MIME_BIN_QP `
# FROM_DO_IT = "yes"
#}
#
#:0 ED
#* ^From:\/.*=\?ISO-?8859.*\?=.*
#{
# FROM = $MATCH
# clean_From = `echo "$FROM" | \
# sed -e 's/=?ISO-\{0,1\}8859-[1-9]?[QqB]?\([^?]*\)?=/\1/g' \
# -e 's/=0D//g' -e 's/=0A//g' | \
# $MIME_BIN_QP `
# FROM_DO_IT = "yes"
#}
:0 Afhw
#* SUBJECT_DO_IT ?? ^^yes^^
#* FROM_DO_IT ?? ^^yes^^
| $FORMAIL \
-I "X-Mime-Header-Decoded: $MIME_TYPE"
:0E fhw
* SUBJECT_DO_IT ?? ^^yes^^
| $FORMAIL \
-i "Subject:$clean_Subject" \
-I "X-Mime-Header-Decoded: $MIME_TYPE"
:0E fhw
* FROM_DO_IT ?? ^^yes^^
| $FORMAIL \
-i "From:$clean_From" \
-I "X-Mime-Header-Decoded: $MIME_TYPE"
:0 fbw i
* MIME_BOUNDARY_COUNT ?? ^^2^^
| $AWK \
' BEGIN {cont=0} { \
if (cont > 0) {cont=0; next} \
if (match($0, BOUNDARY) > 0 ) { next } \
if ( match($0, "^Content-") > 0 ) { \
if (match($0, ";$") > 0) {cont=1} \
next} \
print; \
} \
' BOUNDARY="$MIME_BOUNDARY" \
:0 afbw
| $MIME_BIN_QP
:0 afhw
| $FORMAIL \
-I "Content-Type: text/plain" \
-I "Mime-Version: $MIME_VER" \
-I "X-Mime-Type-Decoded: $MIME_TYPE"
: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"
}
# $MIME_BIN_QP does not handle separate MIME sections
#:0 EB
#*$ $JA_MIME_DECODE_REGEXP
#{
# :0 fbw
# * MIME_B_QP ?? yes
# * B ?? ^Content-Transfer-Encoding: *quoted-printable
# | sed -e "'""\\|$JA_MIME_DECODE_REGEXP|,\\|$MIME_BOUNDARY|p""'"
# :0 Afbw
# | $MIME_BIN_QP
# :0 Afbw
# | $FORMAIL -I "Content-Transfer-Encoding: 8bit"
# :0 fbw
# * B ?? ^Content-Transfer-Encoding: *base64
# | $MIME_BIN_64
# :0 Afbw
# | $FORMAIL -I "Content-Transfer-Encoding: 8bit"
#}
SHELLMETAS = $jaMimeDecodeShellmetas
dummy = "subroutine: pm-mime-decode.rc end."
#:0:
#test
# End of file pm-mime-decode.rc