<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Philipp von Weitershausen wrote:
<blockquote cite="mid447F3E0A.5090507@weitershausen.de" type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:thealx@poczta.onet.pl">thealx@poczta.onet.pl</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap=""><!---->
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=<a class="moz-txt-link-rfc2396E" href="mailto:@@mail.html">"@@mail.html"</a>)
>>> html_email_body = view()
</pre>
</blockquote>
Wow, ingenious in its simplicity! This is what I wanted :) <br>
<blockquote cite="mid447F3E0A.5090507@weitershausen.de" type="cite">
<blockquote type="cite">
<pre wrap="">Could you suggest some points to start with?
</pre>
</blockquote>
<pre wrap="">Buy my book?
Philipp
</pre>
</blockquote>
If you present such tricks there - then it's worth to be bought...<br>
<br>
Best Regards!<br>
Alek.<br>
</body>
</html>