Philipp von Weitershausen wrote:
[EMAIL PROTECTED] wrote:
  
Hi, I need to send some rich-text (HTML) mail, containing information
based on many objects. It would be nice to render it using ZPT
provided by Zope instead of manual creation of HTML text.

Can I (ab)use ZPT for such purpose? I need to design ZPT template and
write corresponding View object. How to wire together the ZPT
template and corresponding View object to render a HTML message and
send it using mail utility?
    

Let's say that the 'mail.html' view provides the HTML for the email body
(whether that's ZPT, Python, or whatever doesn't matter), then you can
simply do:

  >>> from zope.component import getMultiAdapter
  >>> view = getMultiAdapter((obj, request), name="@@mail.html")
  >>> html_email_body = view()
  
Wow, ingenious in its simplicity! This is what I wanted :) 
Could you suggest some points to start with?
    
Buy my book?

Philipp
  
If you present such tricks there - then it's worth to be bought...

Best Regards!
Alek.
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to