[Zope] programmatically determined multipart MIME

J. Cameron Cooper jccooper@rice.edu
Thu, 02 Aug 2001 17:22:39 -0500


So I want to be a ble to send an email from Zope that attaches an 
arbitrary [0..reasonable] number of attachments. You usually do this like

<dtml-sendmail mailhost="Whatever">
To: you@localhost
From: me@localhost
Subject: whatever
<dtml-mime type="text/plain" encode="7bit">
test email
<dtml-boundary type="application/octet-stream" disposition="attachment"
      encode="base64" filename_expr="'fileName.txt'">
file contents</dtml-mime>

</dtml-sendmail>

And there's no problem.

But try to do this:

<dtml-sendmail mailhost="Whatever">
To: you@localhost
From: me@localhost
Subject: whatever 2
<dtml-mime type="text/plain" encode="7bit">
test email 2

<dtml-in files>
<dtml-boundary type="application/octet-stream" disposition="attachment"
      encode="base64" filename_expr="'fileName2.txt'">
<dtml-var fileContents>
</dtml-in></dtml-mime>
</dtml-sendmail>

And Zope complains that the 'boundary' tag isn't expected. I quote:

" Unexpected tag, for tag <dtml-boundary type="application/octet-stream" 
disposition="attachment" encode="base64" 
filename_expr="'fileName2.txt'">, on line X of METHOD"

This seems to me like a reasonable thing to want to be able to do. Is 
there a good reason to forbid this? If there is, I suspect it lies in 
how the tag is called (I still haven't found that), but the contents of 
the "in" should be rendered before the "mime" so we should have the 
parts already, no? Do I have any recourse besides writing the mime stuff 
myself?

            --jcc
        (suspecting)