Carapace

MIME -- Multipurpose Internet Mail Extensions

MIME is used to build mail messages containing multiple attachments which can then be sent using the SMTP protocol across the Internet.

Mime is defined in the standards documents RFC 2045 - 2049

Mime Creation

The create function can be used to create an Mime module eg.

    (create Mime)
Once created, this module is tailored using its properties and methods.

Mime Properties

An Mime module supports the following properties:

property name property type description
separator String separating character used on Content-Type lines
headers List a-list of attribute/value pairs
version String MIME version of a message
contentType String the Content-Type of the message
contentTransferEncoding String the Content-Transfer-Encoding of the message
contentDisposition String the Content-Disposition of the message
mediaType String the media-type fragment (in lower-case) of the Content-Type
mediaSubType String the media sub-type fragment (in lower-case) of the Content-Type
mediaOptions List the a-list of options from the Content-Type
dispositionType String the disposition-type fragment (in lower-case) of the Content-Disposition
dispositionOptions List a-list of attribute/value pairs of options from the Content-Disposition
errorClass Integer class of Mime-specific errors

Mime Methods

The Mime module supports the following methods.

method name description
newBoundary create a new boundary to separate attachments
startMultipart start to build a multipart message
attachFile append a file attachment -- the content type is determined by the filename extension
attachTextFile append a plain text file attachment
attachHTMLFile append an HTML file attachment
attachGIF append an GIF image attachment
attachJPEG append an JPEG image attachment
attachBitmap append an BMP image attachment
attachMsWord append an MS Word document - an optional Binary data item may be supplied which is the content, otherwise the file is opened and the content sent
attachPlain append a plain text attachment
attachMail append a mail message attachment
attachHTML append an HTML attachment
attach append arbitray attachment
buildMultipart build the multipart message, returning (contentType, dataString)
splitHeader split the header off from the message
useContentType use the supplied content type
useHeader get the header info from the supplied text
splitLine split a line in the format xxxxx; attrib=value ...
splitMultipart split the multipart body -- returns a list of (header body) pairs
splitBinaryMultipart split the binary multipart body -- returns a list of (header body) pairs where body is a Binary
findPart attempt to find a bodypart of the given media type and sub type


newBoundary

Create a new boundary to separate attachments.

Arguments: none

Return type: String


startMultipart

Start to build a multipart message.

Arguments: none

Return type: the empty List


attachMsWord

Append an MS Word document - an optional Binary data item may be supplied which is the content, otherwise the file is opened and the content sent.

Arguments:

filenameString
(optional) dataBinary

Return type: the empty List


attachPlain

Append a plain text attachment.

Arguments:

dataString

Return type: the empty List


attachFile

Append a file attachment -- the content type is determined by the filename extension.

Arguments:

pathString

Return type: the empty List


attachTextFile

Append a text file attachment.

Arguments:

pathString

Return type: the empty List


attachHTMLFile

Append an HTML file attachment.

Arguments:

pathString

Return type: the empty List


attachGIF

Append a GIF image file attachment.

Arguments:

pathString

Return type: the empty List


attachJPEG

Append a JPEG image file attachment.

Arguments:

pathString

Return type: the empty List


attachBitmap

Append a bitmap image file attachment.

Arguments:

pathString

Return type: the empty List


attachMail

Append a mail message attachment.

Arguments:

subjectString
dataString

Return type: the empty List


attachHTML

Append an HTML attachment.

Arguments:

dataString

Return type: the empty List


attach

Append arbitray attachment.

Arguments:

headersList
dataString

Return type: the empty List


buildMultipart

Build the multipart message, returning (contentType, dataString).

Arguments:

boundaryString

Return type: List


splitHeader

Split the header off from the message.

Arguments:

msgString

Return type: String


useContentType

Use the supplied content type.

Arguments:

cTypeString

Return type: the empty List


useHeader

Get the header info from the supplied text.

Arguments:

headerString

Return type: the empty List


splitLine

Split a line in the format


     xxxxx; attrib=value ...

Arguments:

lineString

Return type: List


splitMultipart

Split the multipart body -- returns a list of (header body) pairs.

Arguments:

msgString

Return type: List


splitBinaryMultipart

Split the binary multipart body -- returns a list of (header body) pairs where body is a Binary.

Arguments:

msgBinary

Return type: List


findPart

Attempt to find a bodypart of the given media type and sub type.

Arguments:

mediaTypeString
subTypeString
partsList

Return type: List


Contents Index Current topic: communications Related topics: communications classes, objects