sholden at bellatlantic.net
Tue Mar 14 12:30:44 CET 2000
Dana Booth wrote:
> Can someone show me a snippet, or suggest good documentation for using
> Mimetools decdoding a MIME encoded mail file.
> I export the raw message from a mail spool, and my (Perl) script currently
> calls on Metamail to decode the file, using the -w switch to save the parts
> to file. I can be far more flexible with my own module, but am having
> difficulty blindly trying to use Mimetools.
> Dana Booth <dana at oz.net>
> Tacoma, Wa., USA
> key at pgpkeys.mit.edu:11371
I found the mimecntl module much easier to handle than the others,
although initially a little confusing, and I should pass on my thanks
publicly to Daniel Berlin for sending me some sample code and
bringing mimecntl to my attention. You can find the module at
This is adapted from a program which processes several messages
from a mailbox, but it sounds like you don't need that level of
msg = open("test","r")
f = mimecntl.MIME_document(msg)
print len(f.headers), "headers"
if f["content-type"].majortype() == "multipart":
print "Multipart message with", len(f), "items"
print "Standard message of", len(f), "bytes"
"If computing ever stops being fun, I'll stop doing it"
More information about the Python-list