send object via dtml as Mail attachment
Hi there, trying to figure out how to send a DTMLDocument as Mail HTML-Attachment. Problem: Content of index.html object is placed in the body of the mail not atteched. <dtml-sendmail mailhost="MailHost"> To: me <marcus.schopen@uni-bielefeld.de> From: me <marcus.schopen@uni-bielefeld.de> Subject: Test Moin <dtml-mime type=text/html encode="7bit" name=index.html> <dtml-var index.html> </dtml-mime> </dtml-sendmail> mail sent. _______________________________________ (0> Marcus Schopen //\ Bielefeld, Germany V_/_ _______________________________________ Live as variously as possible
Marcus Schopen wrote:
Hi there,
trying to figure out how to send a DTMLDocument as Mail HTML-Attachment. Problem: Content of index.html object is placed in the body of the mail not atteched.
<dtml-sendmail mailhost="MailHost"> To: me <marcus.schopen@uni-bielefeld.de> From: me <marcus.schopen@uni-bielefeld.de> Subject: Test
Moin
<dtml-mime type=text/html encode="7bit" name=index.html> <dtml-var index.html> </dtml-mime>
</dtml-sendmail>
mail sent.
Hi Marcus What about (skip the comments after ###): <dtml-sendmail mailhost="MailHost"> To: me <marcus.schopen@uni-bielefeld.de> Date: <dtml-var ZopeTime fmt="rfc822"> ### Date is essential in emails ;-) From: me <marcus.schopen@uni-bielefeld.de> Subject: Test <dtml-mime type="text/plain" encode="7bit"> #### Here comes text in body Moin, Let me bother you with this nice attachment ! ###After that the attachment <dtml-boundary type="application/octet-stream" disposition="attachment" encode="base64" filename_expr="index.html"><dtml-var expr="index.html.read()"></dtml-mime> </dtml-sendmail> OK, i did not test that, but it might work. Of course you got the file content in the body of your email message, because you have put it there deliberately. Watch in the above especially, how some text body (with MIME type text/plain is completely separate from an attachment part of the email (with MIME type application/octet-stream). You might perhaps like to change this *application/octet-stream* to *text/html* if you want so send html files only. One last note: Be very cautious about *empty line* or *no empty line between*. This can make email sending happening or preventing, especially with MIME type stuff ! I ran also into troubles once, only because I had intended lines (as in the example in the Zope Book, which was simply *not* working, until I kicked out all the line intendations). And still another: the help text for *MIME* in the API/DTML help of Zope has a bug in the example, they give at the end. HTH --Flynt--
participants (2)
-
Flynt -
Marcus Schopen