[Zope] How to create a file and send it by e-mail ?
Tino Wildenhain
tino at wildenhain.de
Tue Oct 11 06:59:20 EDT 2005
Nicolas Georgakopoulos schrieb:
> Hello all, I'm developing using ZPT and I need to create a file (CSV
> format) but I'm having some problems:
>
> * 1. *I only know how to create files with python but I get an
> * Error Type: NameError*
> * Error Value: global name 'file' is not defined.
While I wonder how do you create a file in python using file?
> * I think ZOPE doe's not allow python to create files for security
> reasons. Can I change this security policy or it will make my
> application unsafe? Is there another way to create a file using ZOPE API
> calls ?
You dont need a real (filesystem-) file if all you want is sending it
over the net. Usually you just build a string - for example in python
scripts via print/return printed or as a list which you join.
> * 2.*When I create my file how can I send it as an attachment by mail ?
> (I already have setup my mail host object and I can send mail's
> successfully.)
This is a bit more difficult, there are examples to send mails
with attachments per DTML, but if you want to avoid you either
open the python email package for python scripts or use
ChrisWs product (but I did not have the time to test it - so
try it :-)
Regards
Tino
More information about the Zope
mailing list