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

Sending Attachments with the mime Tag


The mime tag is used in conjunction with the sendmail tag to send attachments along with electronic mail messages17. The 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 boundary tags. Figure 16 uses the mime tag to attach the file, yearly_report, to an email formed by the sendmail tag.

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

<!--#var standard_hmtl_header-->

<!--#sendmail smtphost=gator.digicool.com-->

From: zope@digicool.com

To: <!--#var who-->

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

 

Here is the yearly report.

 

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

 

<!--#/sendmail-->

 

Mail with attachment was sent.

<!--var standard_hmtl_footer-->

The mime tag and boundary tags contain several attributes, listed in Table 18, that specify MIME header information for their particular content. Since the opening 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 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 bo undary , var or closing mime tags. I

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