You are not logged in Log in Join
You are here: Home » Members » mjablonski » NMIMETools - a replacement for the MIMETools

Log in



Folder icon NMIMETools - a replacement for the MIMETools

Download current releases at

N(ew)MIMETools - a replacement for the MIMETools

Problem - How to send all of the files in a folder as attachements using sendmail and 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 (internally it's a blockContinuations-tag).

Solution - Use the NMIMETools-Product

The NMIMETools will give you two new tags: nmime & nboundary. Both have 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. (For some compatibilty with the MIME-RFC's and the original MIMETools: Nesting nmime-tags in nmime-tags is possible, but for most problems this need not to be used at all.)

Example - Sending all files of a folder as attachments

Here's an example of how to send all files of a folder:

   <dtml-sendmail smtphost="">  
   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 

   <dtml-in "objectValues('File')"><dtml-nboundary type_expr="content_type"
   disposition="attachment" encode="base64"

 Title   Type   Size   Modified   Status 
 NMIMETools Edit object Software Release   2002-04-05 published