Is it possible to use procmail with MIME-message? What I mean, is the
possibility to fetch/process each part of multipart message - and on
any level. Actually I need possibility to disassemble MIME message,
process each part separately and then assemble (possibly in the
There's no problem with doing this, but be aware that it will make for a
much bigger recipe than you think. There are a lot of MIME formats out
First you'll need to decode the mail - check the
Content-Transfer-Encoding header for the procedure to use. I use
mimencode -u for this. Then the mail could possibly be 8-bit. This is
OK as long as procmail handles the mail. procmail is 8-bit-clean. But
many mail reading programs aren't, so make sure that the mail is
finished with by the time procmail ends.
For message/rfc822 MIME types you could simply extract the message and
pass it into procmail again, but you have to decide if this is
really what you want. For one thing it makes it very easy to fake mail.
I think the ones you're mainly interested in are the multipart/* types.
multipart/parallel is easy - you split up the mail into pieces then
process the bits accordingly. Same for multipart/mixed.
It's a bit trickier with multipart/alternative - which part
do you process, particularly since procmail may be running on a very
different machine than the machine you read the mail on? I suppose you
could just process them all and reassemble to let the mail agent do the
work of deciding. multipart/digest is a similar case except that the
default Content-Type for each part is message/rfc822.
The only other type you might want to treat is message/partial. This is
for when youare mailed one pobject in several small mails. This is not
much fun to do with procmail, so I suggest in this case using a proper
MIME program such as metamail.
"I'm not a guppy."