Procmail Decoding Mime Messages

Julian H. Stacey jhs at
Thu Apr 25 00:12:21 UTC 2013

Polytropon wrote:
> On Wed, 24 Apr 2013 16:07:35 -0500, Martin McCormick wrote:
> > 	Is there a filter that one can run in procmail in which
> > base64 encoded data go in and text comes out so one can allow
> > procmailrc to do its work?

Good question, I havent tried that yet, (but should),
but I have been demiming both to help majordomo on servers, & via procmail
on local (to reduce bulk on my future archives of personal mail).

2 tools worth knowing in /usr/ports/mail/ : demime emil

A few notes from my
(where I've also more notes on eg much hated quoted-printable )

SUBDIR += emil
#       A candidate to be assesed for stripping quoted-printable from
#       majordomo on server, to help cluless people.
#       Something needed to replace demime as demime has been removed.

# SUBDIR += mime4j
#       "It won't do any decoding of base64 or quoted-printable
#        encoded header fields and bodies."

SUBDIR += demime
#       For majordomo on list servers,
#       For all the many lazy & incompetents who cant turn off sending
#       HTML to mail lists, despite having had a decade to learn.
#       (& for a few people who do understand they should, have tried to, but
#       can''t find where to turn off their HTML, if their ISP even allows.
#       Missing in FreeBSD-9.1-RELEASE so see also SUBDIR += mail/emil

> > 	Is there anything which will take a raw email message
> > and spit out linear strings which can be processed like normal
> > text?

See man emil ; man demime

PS Trying to get procmail to work with a macro with a pipe defined
after + $RCVSTOREUNSEEN, was a long pain & I failed so I use a
longer version below which works, appended for syntax example.


# A 2nd copy, just text, stripped of MIME enclosures is
# The 2nd copy is stored with $RCVSTORE -nounseen so I dont have to 
# click the archive copy from within exmh.

NOMIME="/usr/local/bin/demime -8 -"
#       Demime is not in current after 9.1-RELEASE
#       To not demime instead use       NOMIME=cat
# NOMIME=cat

# NOMIME=/usr/local/bin/emil
#       Emil converts a .jpg MIME to a uuencoded appended without MIME

# I can not seem to achieve something like this:
#               XYZ="$NOMIME | $RCVSTOREUNSEEN"

        :0 cw
        | $NOMIME | $RCVSTOREUNSEEN +$PRI_MAIL/my/archive
        :0 wc

Julian Stacey, BSD Unix Linux C Sys Eng Consultant, Munich
 Reply below not above, like a play script.  Indent old text with "> ".
 Send plain text.  No quoted-printable, HTML, base64, multipart/alternative.

More information about the freebsd-questions mailing list