[Zope] create HTML mail with inline image using MIMETools

Christoph Landwehr chris-zopemailing at gmx.de
Mon Mar 22 12:07:29 EST 2004


Hi,

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.

What I did:

<dtml-sendmail mailhost="MailHost">
From: foo at bar.xy
To: foo at bar.xy
Date: Mon, 22 Mar 2004 16:25:03 +0100
Subject: html with image
MIME-Version: 1.0
Content-Type: multipart/related;
	boundary="----=_NextPart_000_1.0000"

This is a multi-part message in MIME format.

------=_NextPart_000_1.0000
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_2.0000"

------=_NextPart_000_2.0000
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
   <HEAD><TITLE></TITLE></HEAD>
   <BODY>
   <P>Hello World</P>
   <br>
   <IMG src=3D"cid:123 at 456">
   </BODY>
</HTML>

------=_NextPart_000_2.0000--

<dtml-mime>
<dtml-boundary type="image/gif"
                filename="my_image.gif"
                encode="base64"
                cid="123 at 456" >

<dtml-var "test_gif">
</dtml-mime>

------=_NextPart_000_1.0000--



Has anyone succesfully created HTML mails with embedded images using <dtml-mime>?

Regards
Christoph










More information about the Zope mailing list