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
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.
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 |
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 |
newBoundaryCreate a new boundary to separate attachments.
Arguments: none
Return type: String
startMultipartStart 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:
| filename | String |
| (optional) data | Binary |
Return type: the empty List
attachPlainAppend a plain text attachment.
Arguments:
| data | String |
Return type: the empty List
attachFileAppend a file attachment -- the content type is determined by the filename extension.
Arguments:
| path | String |
Return type: the empty List
attachTextFileAppend a text file attachment.
Arguments:
| path | String |
Return type: the empty List
attachHTMLFileAppend an HTML file attachment.
Arguments:
| path | String |
Return type: the empty List
attachGIFAppend a GIF image file attachment.
Arguments:
| path | String |
Return type: the empty List
attachJPEGAppend a JPEG image file attachment.
Arguments:
| path | String |
Return type: the empty List
attachBitmapAppend a bitmap image file attachment.
Arguments:
| path | String |
Return type: the empty List
attachMailAppend a mail message attachment.
Arguments:
| subject | String |
| data | String |
Return type: the empty List
attachHTMLAppend an HTML attachment.
Arguments:
| data | String |
Return type: the empty List
attachAppend arbitray attachment.
Arguments:
| headers | List |
| data | String |
Return type: the empty List
buildMultipart
Build the multipart message, returning
(contentType, dataString).
Arguments:
| boundary | String |
Return type: List
splitHeaderSplit the header off from the message.
Arguments:
| msg | String |
Return type: String
useContentTypeUse the supplied content type.
Arguments:
| cType | String |
Return type: the empty List
useHeaderGet the header info from the supplied text.
Arguments:
| header | String |
Return type: the empty List
splitLineSplit a line in the format
xxxxx; attrib=value ...
Arguments:
| line | String |
Return type: List
splitMultipart
Split the multipart body -- returns a list of
(header body) pairs.
Arguments:
| msg | String |
Return type: List
splitBinaryMultipart
Split the binary multipart body -- returns a list of
(header body) pairs
where body is a Binary.
Arguments:
| msg | Binary |
Return type: List
findPartAttempt to find a bodypart of the given media type and sub type.
Arguments:
| mediaType | String |
| subType | String |
| parts | List |
Return type: List
| Contents | Index | Current topic: communications | Related topics: communications classes, objects |