procmail
[Top] [All Lists]

Re: procmail and MIME?

1995-11-09 04:43:51
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 
same order).

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
there.

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.

-- 
Tim Pickett                                     
tlm(_at_)yoyo(_dot_)cc(_dot_)monash(_dot_)edu(_dot_)au
"I'm not a guppy."                             
tbp(_at_)molly(_dot_)cs(_dot_)monash(_dot_)edu(_dot_)au

<Prev in Thread] Current Thread [Next in Thread>