NMimeToolsCurrent release:
Historic releases: |
Bug reports: maik (dot) jablonski (at) gmail (dot) com |
|
N(ew)MIMETools - a replacement for the MIMEToolsProblem - How to send all files in a folder as attachements using dtml-sendmail and dtml-mime? You cannot create mails with all files of a folder as attachments with the original MIMETools, because you cannot iterate with the in-tag over the original boundary-tag (it's a blockContinuations-tag). Solution - Use the NMIMETools-ProductThe NMIMETools will give you two new tags: nmime & nboundary. Both have nearly the same arguments as the original MIMETools-counterparts. The difference between the MIMETools and the NMIMETools is that the nboundary-tag is now a "real-open-and-close-block"-tag: it must be opened and closed! This will give you the chance to iterate with the in-tag over the nboundary-block. Additionally you can specify your own boundaries in nmime as well as nboundary
with the new argument Example - Sending all files of a folder as attachmentsHere's an example of how to send all files of a folder:
<dtml-sendmail smtphost="127.0.0.1">
To: yourMailAccount@yourMailServer.yourMailDomain
From: zope@yourZopeServer.yourZopeDomain
Subject: NMIME-Example with multiple attachments
<dtml-nmime type="text/plain" encode="7bit">
Just a demonstration how to send multiple attachments with
the NMIMETOOLS.
<dtml-in "objectValues('File')"><dtml-nboundary type_expr="content_type"
disposition="attachment" encode="base64"
filename_expr="_['sequence-item'].getId()"><dtml-var
sequence-item></dtml-nboundary></dtml-in></dtml-nmime>
</dtml-sendmail>
And here is the same example using the optional nmime-specific
boundary/boundary_expr arguments::
<dtml-let CUSTOM_BOUNDARY="'myOwnBoundary' + _.str(_.abs(_.hash(REQUEST)))">
<dtml-sendmail smtphost="127.0.0.1">
To: yourMailAccount@yourMailServer.yourMailDomain
From: zope@yourZopeServer.yourZopeDomain
Subject: NMIME-Example with multiple attachments
<dtml-nmime type="text/plain" encode="7bit" boundary_expr="CUSTOM_BOUNDARY">
Just a demonstration how to send multiple attachments with
the NMIMETOOLS with customized boundaries.
<dtml-in "objectValues('File')"><dtml-nboundary type_expr="content_type"
disposition="attachment" encode="base64" boundary_expr="CUSTOM_BOUNDARY">
filename_expr="_['sequence-item'].getId()"><dtml-var
sequence-item></dtml-nboundary></dtml-in></dtml-nmime>
</dtml-sendmail>
</dtml-let>
Bug Reports and CommentsPlease send all bug-reports and comments to: maik.jablonski@uni-bielefeld.de |
CHANGESNMimeTools - ChangesVersion 1.0 - fixed bug: NMimeTools weren't thread safe (they used a global stack to store the boundaries), so creating lots of mails at once could result in wrong boundaries. - added new arguments for nmime-/nboundary: boundary and boundary_expr, so you can specify your own boundary for nested MIME-Mails. - many whitespace cleanups Version 0.20325 - first public release of NMimeTools |
|