[Zope] how to send email witch attachment in python

Christian Otteneuer chotty at freenet.de
Fri Oct 8 14:21:18 EDT 2004


Hello NG,

How can I send an email with an attachment from a python script?
My code so far:

mailhost = container.mailHost
mMsg = 'MessageText'
mTo = 'you at you.com'
mFrom = 'me at me.com'
mSubj = 'Subject'

This code sends me an email with 'Subject' and 'MessageText' .
After googling and reading in different tutorials, I found a way to 
implement it in dtml:

<dtml-sendmail smtphost="MailHost">
To: you at you.com
From: Me me at me.com
Subject: <dtml-var "var1">
<dtml-mime type="text/plain" encode="7bit">
Hi, please take a look at my resume.
<dtml-boundary type="application/octet-stream" disposition="attachment"
encode="base64" filename_expr="resume_file.getId()"><dtml-var
expr="resume_file">
</dtml-mime>
</dtml-sendmail>But how to do so in python only?Thanks alotChristian





More information about the Python-list mailing list