Preface
There are several MIME aware Mail User Agents (MUAs) that can
decode and upack the mime attachements that you receive. If
you don't have such MUA yes, consider getting one.
Procmail solution
First, procmail is not the right tool to handle MIME messages,
but nonetheless there exists couple of procmail mime modules
that can solve _some_ of the mime issues. This post's intention is to
introduce you to those modules and to explain when you would
use them
Overview
o to kill unwanted mime garbage from the message,
choose pm-jamime-kill.rc
o to save file attachement from a message, choose pm-jamime-save.rc
o to decode qp or base64, choose pm-jamime-decode.rc
The all available modules are available at:
Subject: send pm-code.shar (also "send help" "send ls-l.txt")
Description of the modules in the shar file can be viewed at:
ftp://cs.uta.fi/pub/ssjaaa/pm-code.html
module: pm-jamime-kill.rc
Microsoft Explorer has a bad habbit of including 7k
application/ms-tnef attachement to the end of message. If you don't
want to see that additional ms-tnef attachement, then plug in this
module and you no longer see MS Explorer cruft.
This recipe works like this: If email's structure is
--boundary
message-text (maybe quoted-printable)
--boundary
some-unwanted-mime-attachement
--boundary
then the attachement is killed from the body. The message-text part
is also decoded if it was quoted printable. This leaves clean text;
with no MIME anywhere. MIME headers have been modified as needed
(due to conversion from multipart and possibly quoted printable to
plain text):
message
Applications for other mime attachements
Lotus Notes sends similar extra attachement and you can use this
same recipe to kill it. See example section.
Microsoft Express sends a copy of message in html format in the
attachement, you can kill that too, see example section.
Netscape's Mozilla sends a copy of message in html. See example.
Also it sends `vcards'
module: pm-jamime-save.rc
This includerc reads saves _one_ simple file attachement (MIME)
from he message. The message must define following MIME headers.
If "filename=" does not exists, then the message will not be
handled.
Mime-Version: <version>
Content-Type: <type>
Content-Disposition: attachment; filename="file.txt"
Procmail is not very suitable for saving MIME attachements and
you should not think that this the right tool for you.
If you receive anything more than 1 attachement, this recipe
does nothing, because that's out of our league and you need some
more heavy weight mime tools. Eg. Perl CPAN has MIME libraries.
_Note_: When the attachement is in the body, it is simply written
to a disk and the place is replaced with message
Extracted to file:/users/jaalto/junk/file.txt.1998-03-30
module: pm-jamime-decode.rc
The original father of the decoding scheme used here was
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_.
end