Looking inside MIME (was Re: State of procmail)

R A Lichtensteiger <[email protected]> Sat, 20 Aug 2016 23:11:29 -0400
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
John Levine wrote:

>> I do not understand the problem.   The mime headers are plain-text, ther=
e is
>> no problem regarding to procmail recipes.
>
> It would be nice if procmail's regexes could match the text inside
> MIME-encoded headers.  And it would also be nice if there were some
> way to tell it to look for particular kinds of body parts and look
> inside the contents.

Procmail needs some help, but it is easily doable:

   (In the recipe below $atext is as defined in RFC5322 section 3.2.3.)

   :0
   * SUBJECT ?? =3D(20[$atext]+|\?ISO-8859-1)
   {
     SUBJECT=3D`echo "$MATCH" | mimencode -u -b`

     :0 hfw
     | formail -i "Subject: $SUBJECT"
   }

Using mimencode is a little heavyweight, but processor is a lot
cheaper than it used to be ...

Reto
-- =

R A Lichtensteiger	[email protected]

    "I am truly in awe how deeply the implications and alternatives have
     been analysed.  This is particularly impressive given the complete
     absence of any facts about the alleged proposal."  -- Randy Bush on NA=
NOG