#
# Un-MIME everything so that we don't get bothered by MIME used for
# plain text messages, which is about the most common thing we get.
#
# Non-text message should be left in ~/mail/MIME. A copy of any
# real MIME messages is left in folder +mime, for inspection and
# debugging. Text-only messages bearing MIME attributes in the header
# are simply translated without leaving trace...
#
# The Content-Type rules after catches those broken mailers which append
# a Content-Type header and use MIME =xx escapes to encode some characters.
# There's no need to RESYNC in that case since we leave the headers intact.
#

Mime-Version: /^\d/		{ REJECT MIME };

<MIME> Content-Type: /multipart/		{ SAVE +mime; REJECT REAL };
<MIME> Body <1,10>: /^Content-Type:/i	{ SAVE +mime; REJECT REAL };
<MIME,REAL> {
	FEED ~/mail/unmime;
	STRIP Mime-Version Content-Transfer-Encoding Content-Type;
	RESYNC; REJECT INITIAL;
};

Content-Type: /^text/i { FEED ~/mail/unmime -e; REJECT };

