[Zope] Re: Mail

Flynt rhess@bic.ch
Wed, 04 Jul 2001 02:05:39 +0200


zoops4@yahoo.com wrote:
> 
> Hi,
> 
> I am trying to send e-mail with attachment using <dtml-sendmail>.  I
> noticed you had the same problem earlier, therefore I hope you can
> give me some suggestions.  This is the code that I am using
> 
> First try:
> 
> <dtml-mime type=text/plain encode=7bit>
> 
> <dtml-boundary type=application/octet-stream
>                 disposition=attachment encode=base64>
>                 <dtml-var "selected_image.read()">
> 
> </dtml-mime>
> 
> first error:
> 
> Error Type: AttributeError
> Error Value: 'string' object has no attribute 'read'
> 
> Second try:
> 
> <dtml-mime type=text/plain encode=7bit>
> 
> <dtml-boundary type=application/octet-stream
>                 disposition=attachment encode=base64>
>                 <dtml-var "restrictedTraverse(selected_image).read()">
> 
> </dtml-mime>
> 
> Second Error:
> 
> Error Type: AttributeError
> Error Value: read
> 
> Thank you in ahead of time.
> 
> Vid

Hi Vid

(You mailed me personally, but I cc to the list with your permission ;-)

This code is working for me with documents and files (but not with
images stored in the ZODB); I tried it with binary, pdf and html
content.

<dtml-sendmail mailhost="MailHost">
From: <dtml-var sender>
To: <dtml-var recipient>
Date: <dtml-var ZopeTime fmt="rfc822">
Subject: Testmessage
<dtml-mime type="text/plain" encode="7bit">

testmessage textbody

<dtml-boundary type="application/octet-stream" disposition="attachment"
encode="base64" filename="testfile"><dtml-var testfile></dtml-mime>
</dtml-sendmail>

Regards

--- Flynt