[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() >>> from email.MIMEText import MIMEText >>> message = MIMETExt(html_email_body.encode('utf-8'), ... 'text/html', 'utf-8') >>> # etc. >>> from zope.component import getUtility >>> mailer = getUtility(IMailDelivery, 'your-delivery-utility') >>> mailer.send(from, to, message.as_string()) > Could you suggest some points to start with? Buy my book? Philipp _______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users