Previous Chapter | Next Chapter | Up | Next Section | Contents

Sending Attachments with the dtml-mime Tag

The dtml-mime tag is used in conjunction with the dtml-sendmail tag to send attachments along with electronic mail messages16. The dtml-mime tag automatically sets the content type of the entire message to multipart/mixed. Thus, a variety of data can be attached to a single message using one or more dtml-boundary tags. Figure 16 uses the dtml-mime tag to attach the file, yearly_report, to an email formed by the dtml-sendmail tag.

The dtml-mime tag used to attach a file to an email message

<dtml-var standard_hmtl_header>



To: <dtml-var who>

<dtml-mime type=text/plain encode=7bit>


Here is the yearly report.


<dtml-boundary type=application/octet-stream disposition=attachment encode=base64><dtml-var "yearly_report">





Mail with attachment was sent.

<dtml-var standard_hmtl_footer>

The dtml-mime tag and dtml-boundary tags contain several attributes, listed in Table 19, that specify MIME header information for their particular content. Since the opening dtml-mime tag in Figure 16 contains the body of the message, and does not require encoding, encode is set to 7bit.

Notice in Figure 16, there is no space between the opening dtml-mime tag and the TO: header. If a space is present, then the message will not be interpreted as by the receiving mailreader. Also notice, there are no spaces between the dtml-boundary, var or closing dtml-mime tags. I

dtml-mime tag attributes




Sets the MIME header, Content-Type, of the subsequent data.


Sets the MIME header, Content-Disposition, of the subsequent data. If disposition is not specified in a mime or boundary tag, then Content-Disposition MIME header is not included


Sets the MIME header, Content-Transfer-Encoding, of the subsequent data. If encode is not specified, base64 is used as default. The options for encode are: base64, uuencode, x-uuencode, quoted-printable, uue, x-uue, and 7bit. No encoding is done if set to 7bit.

Previous Chapter | Next Chapter | Up | Next Section | Contents