[Zope] how to send email witch attachment in python

  • Thread starter Christian Otteneuer
  • Start date
C

Christian Otteneuer

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 = '(e-mail address removed)'
mFrom = '(e-mail address removed)'
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: (e-mail address removed)
From: Me (e-mail address removed)
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
 
M

Michele Simionato

Christian Otteneuer said:
Hello NG,

How can I send an email with an attachment from a python script?

If you want to send an email using Zope you are OT and you should ask
a Zope list; OTOH if you want to send an email from Python, just
use the email module and look at the documentation in the standard
library (especially the examples; they show how to do what you ask).

Michele Simionato
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top