[Zope] MimeWriter and encode64 with zope file objs

drew nichols drew@mena.org.au
Thu, 05 Jun 2003 09:40:07 +1000

I want to attach zope file objects (CMF Portal File) to a multipart 
email like this:

for fileId in attachments:
                file = getattr(self, fileId)
                part = writer.nextpart()
                #part.addheader('Content-Transfer-Encoding', 'none')
                part.addheader('Content-Transfer-Encoding', 'base64')
                body = part.startbody ( file.getContentType() + '; 
name=' + file.id() )
                base64.encode (file, body)

This works fine with no encoding and text data, but binary data needs 
encode64 will not encode as the zope file has no read() method.
Should i write my own wrapper class, or is there a simpler way??