Sendmail, Python and ZPT
Hi; It appears that ZPT doesn't yet work with our sendmail object. Now, I'm fine with using DTML to render sendmail, but since I'm converting to ZPT, I have this one last issue to deal with. Would someone tell me how to render sendmail using a Python script? TIA, beno
beno writes:
It appears that ZPT doesn't yet work with our sendmail object. Now, I'm fine with using DTML to render sendmail, but since I'm converting to ZPT, I have this one last issue to deal with. Would someone tell me how to render sendmail using a Python script? Please search the mailing list archives. Several threads have addressed this problem.
Dieter
At 07:07 PM 11/3/2002 +0100, you wrote:
beno writes:
It appears that ZPT doesn't yet work with our sendmail object. Now, I'm fine with using DTML to render sendmail, but since I'm converting to ZPT, I have this one last issue to deal with. Would someone tell me how to render sendmail using a Python script? Please search the mailing list archives. Several threads have addressed this problem.
I'm sure you're right. However, I searched through half a year of the archives for this and the ZPT list and found no references to *sendmail* in the subject that also implied ZPT. Would you help me anyway? Since this is important, I believe I'll write a How-To when I'm done. Thank you, beno
On Sun, Nov 03, 2002 at 07:12:42PM -0400, beno wrote:
I'm sure you're right. However, I searched through half a year of the archives for this and the ZPT list and found no references to *sendmail* in the subject that also implied ZPT. Would you help me anyway? Since this is important, I believe I'll write a How-To when I'm done.
I think the prevailing wisdom is that ZPT is best suited for XML-type content, and that DTML is still needed for non-XML dynamic content (email, javascript, etc.). You can still use ZPT as a front-end, but you'll need DTML or a Python script in the back to do the actual email composition. http://www.zopelabs.com/cookbook/991178206 for info on sending mail via Python script. ZPT/DTML version in German, possibly not completely applicable: http://www.dzug.org/Members/mschopen/index_html/howto/cmf_mailhost -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
At 05:30 PM 11/3/2002 -0600, you wrote:
On Sun, Nov 03, 2002 at 07:12:42PM -0400, beno wrote:
I'm sure you're right. However, I searched through half a year of the archives for this and the ZPT list and found no references to *sendmail* in the subject that also implied ZPT. Would you help me anyway? Since this is important, I believe I'll write a How-To when I'm done.
I think the prevailing wisdom is that ZPT is best suited for XML-type content, and that DTML is still needed for non-XML dynamic content (email, javascript, etc.). You can still use ZPT as a front-end, but you'll need DTML or a Python script in the back to do the actual email composition.
Yes. It seems we lean toward the Python scripts since this can be integrated with ZPT.
http://www.zopelabs.com/cookbook/991178206 for info on sending mail via Python script.
It threw an error. Here's the script: try: mailhost=getattr(context, context.mailScript('MailHost')[0].id) except: raise AttributeError, "cant find a Mail Host object" I changed the name of the script to mailScript() from superValues(). I didn't pass any parameters. The original script had *Mail Host* as opposed to *MailHost* but I tried both. What am I missing? TIA, beno
On Monday 04 November 2002 8:42 am, beno wrote:
try: mailhost=getattr(context, context.mailScript('MailHost')[0].id) except: raise AttributeError, "cant find a Mail Host object"
I changed the name of the script to mailScript() from superValues(). I didn't pass any parameters. The original script had *Mail Host* as opposed to *MailHost* but I tried both. What am I missing?
That bald except may be catching an error different to the one you are expecting.
On Mon, 4 Nov 2002, beno wrote:
It threw an error. Here's the script:
try: mailhost=getattr(context, context.mailScript('MailHost')[0].id) except: raise AttributeError, "cant find a Mail Host object"
I changed the name of the script to mailScript() from superValues(). I Uhmm, why did you changed that???
didn't pass any parameters. The original script had *Mail Host* as opposed to *MailHost* but I tried both. What am I missing? Just use "Mail Host" (with the space included). I just tried to remove the space according to the Id of my MailHost object but this failed but worked well exactly as coppied from the above URL.
Further question: Any example how to add an attachment (for instance PDF) to the mail? Kind regards Andreas.
On Mon, Nov 04, 2002 at 04:42:10AM -0400, beno wrote:
I changed the name of the script to mailScript() from superValues(). I didn't pass any parameters. The original script had *Mail Host* as opposed to *MailHost* but I tried both. What am I missing?
The explanation attached to the recipe said "if you have a Mail Host anywhere below the location of this script (superValues()) it will use the first one it finds (thus the [0]). if not it will raise an Exception, which you can catch in your DTML. " So the superValues() call is pretty essential to its function. I'm not sure how "above" and "below" were defined for the author, but add a mailhost object somewhere in one of the parent folders of the script and try it unedited first. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
At 07:51 AM 11/4/2002 -0600, you wrote:
On Mon, Nov 04, 2002 at 04:42:10AM -0400, beno wrote:
I changed the name of the script to mailScript() from superValues(). I didn't pass any parameters. The original script had *Mail Host* as opposed to *MailHost* but I tried both. What am I missing?
The explanation attached to the recipe said "if you have a Mail Host anywhere below the location of this script (superValues()) it will use the first one it finds (thus the [0]). if not it will raise an Exception, which you can catch in your DTML. "
So the superValues() call is pretty essential to its function. I'm not sure how "above" and "below" were defined for the author, but add a mailhost object somewhere in one of the parent folders of the script and try it unedited first.
<:-} This is what I get for assuming that just because they called their script superValues() and I didn't that a call to superValues() wasn't a call to the script they wrote. Thank you. Sorry for wasting your time. beno
Mike Renfro wrote:
I think the prevailing wisdom is that ZPT is best suited for XML-type content, and that DTML is still needed for non-XML dynamic content (email, javascript, etc.).
It is, but it's wrong ;-) I'd recommend using Script (Python)'s if you need to send mail and not using DTML at all. cheers, Chris
participants (6)
-
Andreas Tille -
beno -
Chris Withers -
Dieter Maurer -
Mike Renfro -
Toby Dickenson