[Zope] Sending mail with attachments via Python

J Cameron Cooper zope-l at jcameroncooper.com
Tue May 3 17:42:06 EDT 2005


Kirk Strauser wrote:

 > On Tuesday 03 May 2005 16:09, J Cameron Cooper wrote:
 >
 >> So you have it in DTML and want to re-write in Python but you don't want
 >> to do it in Python?

What's wrong with External Methods? It takes all of about 5 seconds more 
than a TTW Python script. They're a necessary security precaution, but 
not all that burdensome. (You don't want your users having access to 
exec(), do you?)

 > No.  I have it in DTML and want to re-write it in Python without 
involving External Methods or other hackery.
 >
 >> Then why change it? It works, right?
 >
 >
 > For certain values of "works", sure.  The problem I'm trying to solve
 > is that the body of the email needs to become more complex than I'm
 > willing to handle with DTML.

You don't have to write the body in DTML. Create a method that does the 
body however you like and include it in the message by calling it with a 
dtml-var. You could use a Python script or ZPT or whatever.

 > The natural next step for me was to look into rewriting the whole
 > mail-sending object in Python, but I didn't expect that I'd have to
 > reimplement the functionality of DTML to do it.

How did you want it to work? There's DTML and there's Python libs. I 
can't imagine another way, but maybe I'm in too deep.

         --jcc
-- 
http://plonebook.packtpub.com/


More information about the Zope mailing list