[Zope] Sending mail with attachments via Python

Kirk Strauser kirk at daycos.com
Tue May 3 16:14:48 EDT 2005


I'm currently trying to replace a bit of DTML with a Python script.
Here's what I currently have:

<dtml-sendmail mailhost="outboundserver">
To: <dtml-var recipientemail>
From: <dtml-var senderemail>
Subject: <dtml-var subject>
<dtml-mime type="text/plain" encode="7bit">

Attention <dtml-var recipientname>:

This file was sent to you from the Foo Company web site.

The sender included this message:

<dtml-var emailbody>

<dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="filename"><dtml-var expr="publicstore.download(filename=filename,password=password,skipctypeheader=1)"></dtml-mime>
</dtml-sendmail>

Basically, it fetches a file from a public download directory, encodes it
as a MIME attachment, and sends the works to the specified recipient.  Now,
the documentation on sending a normal text email is easy enough to find,
but from Googling around for more advanced docs it seems like I'm the only
person to ever want to do this.  Are there any examples for this sort of
thing lying around that I somehow managed not to find?

Many thanks,
-- 
Kirk Strauser
The Day Companies


More information about the Zope mailing list