procmail
[Top] [All Lists]

Re: mime

1995-10-17 19:02:58
Has anyone setup procmail to handle mime'd messages?  I'm going
to have to figure out how and want to know if someone already has.

It's difficult to get procmail to decode any arbitrarily complex MIME
message.  What if it's a multipart/alternative message, and the part to
decode depends on what computer you are reading the mail on, and not
what computer is running procmail?  There are other examples of
difficulties here.

I have a recipe for automatically decoding quoted-printable
Content-encoding messages.  I figure that this is safe with most mail
readers.  You could also decode BASE64 the same way but this should
probably be put in a separate file a la uuencoded messages rather than
stay in the mail message.

This is the quoted-printable decoder:

# Recipe: Decode MIME quoted-printable Content-Transfer-Encoding
# Conditions: Mail has a MIME-Version header with a number in it.
#             Header saying "Content-Transfer-Encoding: quoted-printable"
#               exists
# Action: perform subrecipes.
:0
* ^MIME-Version:[ \t]*[0-9]*(\.[0-9]*)
* ^Content-Transfer-Encoding:[ \t]*quoted-printable
{
  # Recipe: Remove MIME Content-Transfer-Encoding header line.
  # Flags: Use this recipe as a filter.
  #        Only give the header to formail.
  # Action: Use formail to remove the header line.
  :0 fh
  | formail -I"Content-Transfer-Encoding:"

  # Recipe: Decode the body.
  # Flags: Use this recipe as a filter.
  #        Give only the body to the pipe.
  # Action: Use mmencode to decode the text.
  :0 fb
  | mmencode -u -q
}

-- 
Tim Pickett                                     
tlm(_at_)yoyo(_dot_)cc(_dot_)monash(_dot_)edu(_dot_)au
"You silly sidewalker!"                        
tbp(_at_)molly(_dot_)cs(_dot_)monash(_dot_)edu(_dot_)au

<Prev in Thread] Current Thread [Next in Thread>
  • mime, vaughn skinner
    • mime, vaughn skinner
    • Re: mime, Tim Pickett <=