Below is a sample python script courtesy of runyaga... ______ try: mailhost=getattr(context, context.superValues('Mail Host')[0].id) except: raise AttributeError, "cant find a Mail Host object" mMsg = 'a testful email message \n that contains a few line breaks. \n ~runyaga' mTo = 'runyaga@abc.com' mFrom = 'runyaga@xyz.com' mSubj = 'mail subject' mailhost.send(mMsg, mTo, mFrom, mSubj) ______ Has anyone been able to modify the above script so that e-mail attachments could be sent? As far as I can tell, the mailhost.send call doesn't accept e-mail attachments. However, the DTML sendmail does accept attachments. The code that I currently use does not use DTML (it uses a python script). Must I use DTML if I want to send e-mail attachments? Thanks in advance, Ron
On Tue, 16 Apr 2002 18:21:39 +0000 (GMT) complaw@hal-pc.org wrote:
As far as I can tell, the mailhost.send call doesn't accept e-mail attachments. However, the DTML sendmail does accept attachments.
The code that I currently use does not use DTML (it uses a python script). Must I use DTML if I want to send e-mail attachments?
If you use the MIMETools-<dtml-sendmail>-tag, you can't attach several attachments to one mail. maybe you should have a look at the NMIMETools at http://www.zope.org/Members/mjablonski/ greetings, maik.
If you use the MIMETools-<dtml-sendmail>-tag, you can't attach several attachments to one mail. maybe you should have a look at the NMIMETools at This is misleading. You can attach several attachments with the sendmail tag. I have many scripts that do it.
What you can't do...is loop <dtml-boundary> to programmatically add multiple attachments. Maik, I like your nmime idea. Would it be difficult for you to alter/patch the Zope core to add an end-tag to <dtml-boundary>, making it a block tag? Adding a </dtml-boundary> would solve the problem in Zope, and would be a great addition to 2.6. Thanks, Trevor
http://www.zope.org/Members/mjablonski/
greetings, maik.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, 16 Apr 2002 22:23:35 -0400 "Trevor Toenjes" <zope@toenjes.com> wrote:
If you use the MIMETools-<dtml-sendmail>-tag, you can't attach several attachments to one mail. maybe you should have a look at the NMIMETools at This is misleading. You can attach several attachments with the sendmail tag. I have many scripts that do it.
you are right, trevor... sorry for my wrong description...
What you can't do...is loop <dtml-boundary> to programmatically add multiple attachments.
that's what I meant...;-)
Maik, I like your nmime idea. Would it be difficult for you to alter/patch the Zope core to add an end-tag to <dtml-boundary>, making it a block tag? Adding a </dtml-boundary> would solve the problem in Zope, and would be a great addition to 2.6.
my problem is: when I patch the core-code so that it understands only a <dtml-boundary>...</dtml-boundary>, this might break existing code. and I haven't worked it out to do something like: if only a single <dtml-boundary> is found, do it the old way, if a <dtml-boundary>...</dtml-boundary> exists, do it the new way. so what to do? greetings, maik.
Hi, --On Mittwoch, 17. April 2002 10:19 +0200 Maik Jablonski <maik.jablonski@uni-bielefeld.de> wrote:
On Tue, 16 Apr 2002 22:23:35 -0400 "Trevor Toenjes" <zope@toenjes.com> wrote:
If you use the MIMETools-<dtml-sendmail>-tag, you can't attach several attachments to one mail. maybe you should have a look at the NMIMETools at This is misleading. You can attach several attachments with the sendmail tag. I have many scripts that do it.
you are right, trevor... sorry for my wrong description...
What you can't do...is loop <dtml-boundary> to programmatically add multiple attachments.
that's what I meant...;-)
Maik, I like your nmime idea. Would it be difficult for you to alter/patch the Zope core to add an end-tag to <dtml-boundary>, making it a block tag? Adding a </dtml-boundary> would solve the problem in Zope, and would be a great addition to 2.6.
my problem is: when I patch the core-code so that it understands only a <dtml-boundary>...</dtml-boundary>, this might break existing code. and I haven't worked it out to do something like: if only a single <dtml-boundary> is found, do it the old way, if a <dtml-boundary>...</dtml-boundary> exists, do it the new way.
so what to do?
It would not break existing code if nobody is using the dtml scripting in new code anyway :) Even sending mail is much cleaner in Python Scripts. See MailHostObject.send( messageText, mto, mfrom, subject,encode) Regards Tino Wildenhain
participants (4)
-
complaw@hal-pc.org -
Maik Jablonski -
Tino Wildenhain -
Trevor Toenjes