[Zope] create HTML mail with inline image using MIMETools

Dieter Maurer dieter at handshake.de
Tue Mar 23 15:18:09 EST 2004


Christoph Landwehr wrote at 2004-3-22 18:07 +0100:
>I need to create a HTML mail (yes, I kow ...) with an embedded image within Zope 
>and send it using sendmail. To be able to set the Content-ID, I use version 1.12 
>of the MIMITools (http://cvs.zope.org/Products/MIMETools/MIMETag.py)
>
>However I get stuck because I can not set the boundary string within the 
><dtml-mime> tag. A random boundary is generated by the <dtml-boundary> tag but I 
>need to know the boundary string to set it in the mail header.

The "dtml-mime" is supposed to set the "boundary" itself.
It might be necessary to enhance this tag a bit in order
to generate a "multipart/related" rather than a "multipart/mixed"
"Content-Type".

As an alternative, you can use Pythons "email" package (part
of Pythons standard library from Python 2.2 on, can be used
for Python 2.1.3 as well) to construct the message and
then send it via the "MailHost"'s "send" method.
You will need an External Method for this (or allow import
and use of the Email package for Python Scripts --> Zope Developer Guide).

-- 
Dieter



More information about the Zope mailing list