(yet again, please CC zope@zope.org in replies..)

Nicolas Georgakopoulos wrote:
I think I need it...

I don't ;-)

I have made a web page (ZPT) that a user answer's to a questionnaire , most of the answers are provided by check boxes and radio buttons. When the user submit the answers a mail is send with the answers by text in a string format like coma separated values.

You have a python script to do this, right?

The problem is that my client request to get the answer by mail with a file as an attachment so he can analyze the data with a statistical program SPSS.
Can this be done with Zope File Object ? (I don't think it can... )

You don't need a file object. Build the thing you want to send as a string called data, and have a string variable called filename containing the name you want to use for the attachment.

Then you need create a MIMEBase object for it:

# some imports
from email.MIMEBase import MIMEBase
from email import Encoders

# now create the attachment
msg = MIMEBase(maintype, subtype)
msg.add_header('Content-Disposition', 'attachment',

# now render the MailTemplate
wrapper = context.my_mail_template.as_message(
    # insert params here
# finally, attach the file and send

You may also be interested in something I will likely add for the 1.1.0 release:




Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to