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 messages. 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.
<dtml-var standard_hmtl_header>
<dtml-sendmail smtphost=gator.digicool.com>
From: zope@digicool.com
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">
</dtml-mime>
</dtml-sendmail>
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
Name
|
Description
|
type
|
Sets the MIME header, Content-Type, of the subsequent data.
|
disposition
|
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
|
encode
|
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