[Zope] change to MimeWriter to add "MIME-Version: 1.0"
Pate, Clarence T
Clarence.Pate@bridge.bellsouth.com
Wed, 6 Oct 1999 10:09:28 -0500
If anyone is interested in the "MIME-Version header", I have played with the
mime stuff and read rfc1341 to understand better how this stuff works. I am
enclosing a subset of MimeWriter.py which will allow the functions to put the
"MIME-Version: 1.0" header in the correct place. I would like to warn everyone
that I am not a python programmer, and there might be a better way to do this.
The changed subset:
def startbody(self, ctype, plist=[], prefix=1, version=0):
for name, value in plist:
ctype = ctype + ';\n %s=\"%s\"' % (name, value)
self.addheader("Content-Type", ctype, prefix=prefix)
if version:
self.addheader("MIME-Version", "1.0", prefix=1)
self.flushheaders()
self._fp.write("\n")
return self._fp
def startmultipartbody(self, subtype, boundary=None, plist=[], prefix=1):
self._boundary = boundary or mimetools.choose_boundary()
return self.startbody("multipart/" + subtype,
[("boundary", self._boundary)] + plist,
prefix=prefix, version=1)
This will only place the "MIME-Version: 1.0" header if you are using the
<!--#mime --> tag. This sends a multipart/mixed message.
Clarence T. Pate