The MIME class allows for the simple encoding and decoding of MIME structures such as message attachments, file uploads, etc.
The class may be used for decoding or encoding of messages. Message holds the content of the encoded message or the filename which holds the encoded data. The decoded data is provided in Parts properties.
To decode a MIME message you should first assign either the whole message (headers and body) to Message or put the message headers into the MessageHeaders property and the message body or the filename holding it into the Message property. Calling DecodeFromFile or DecodeFromString directs the class to start parsing the message: it will fill out the ContentType, ContentTypeAttr properties with message content type information, and enter information about message parts into the Parts properties, which includes: part sizes, part content types, part content type attributes, part content disposition, part content disposition attributes, part encoding, part name, part filename, part headers, or part content (part decoded string or part decoded file) for each decoded part.
Calling the DecodeFromString or DecodeFromFile to decode doesn't actually decode the message but only parses it. The real decoding is done when the part content in the Parts properties is first accessed.
To encode data into a MIME message you should first assign values for each part to either part decoded string or part decoded file in the Parts properties property, and optionally assign values to the other part attributes in the Parts properties. Assigning a value to the part decoded string or part decoded file through the Parts properties, fills out automatically the part headers into the Parts properties for the respective part. Calling EncodeToFile or EncodeToString directs the class to fill out the Message with the message body and the MessageHeaders with the headers.
The Progress event is fired as the message is parsed and the data is decoded/encoded.
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
|- boundary||The boundary separating the MIME parts. Maximum length of 80 bytes.|
|- contentType||The value of the content-type header of the message which was encoded/decoded.|
|- contentTypeAttr||The attributes for content-type header of the message which was encoded/decoded.|
|- message||Contains the encoded message text or a path to a file which contains the encoded message text.|
|- messageHeaderCount||The number of records in the MessageHeader arrays.|
|- messageHeaderField:(int)messageHeaderIndex||This property contains the name of the HTTP header (same case as it is delivered).|
|- messageHeaderValue:(int)messageHeaderIndex||This property contains the header contents.|
|- messageHeadersString||String version of the MIME message headers.|
|- partCount||The number of records in the Part arrays.|
|- partContentDisposition:(int)partIdx||Content disposition for each part.|
|- partContentDispositionAttr:(int)partIdx||The content disposition's attribute (if any) for each part.|
|- partContentId:(int)partIdx||Content identifier for each part.|
|- partContentType:(int)partIdx||Content type for each part.|
|- partContentTypeAttr:(int)partIdx||The content type attribute, if any, for each part.|
|- partDecodedFile:(int)partIdx||The filename with the decoded data.|
|- partDecodedString:(int)partIdx||This property holds the actual content of each part.|
|- partEncoding:(int)partIdx||This property contains the actual content encoding type for each part.|
|- partFilename:(int)partIdx||This property contains the filename attribute specified in the headers of the part.|
|- partHeaders:(int)partIdx||This property contains the headers for each MIME part.|
|- partName:(int)partIdx||This property contains the name given to a part, such as the filename.|
|- partSize:(int)partIdx||This property contains the size of the DecodedFile or DecodedString .|
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
|- config||Sets or retrieves a configuration setting.|
|- decodeFromFile||Decodes from file.|
|- decodeFromString||Decodes from string.|
|- encodeToFile||Encodes to file.|
|- encodeToString||Encodes to string.|
|- reset||Reset the class.|
|- resetData||Resets the values of all headers and Part- properties.|
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
|- onError||Information about errors during data delivery.|
|- onHeader||Fired every time a header is parsed.|
|- onProgress||Shows the progress of decoding/encoding the input data.|
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
|DecodeMessageHeaders||Instructs the class to automatically decode message headers.|
|IncludeHeaders||Tells the class whether to include the headers when encoding the message.|
|RequireVersionHeader||Specifies whether or not the class should require the version header.|
|SanitizeFilename||Whether invalid characters are replaced in MIME part filenames.|
|TempFilePath||If set, the temporary files created during MIME decoding and encoding will be put in the path specified.|
|BuildInfo||Information about the product's build.|
|CodePage||The system code page used for Unicode to Multibyte translations.|
|LicenseInfo||Information about the current license.|
|ProcessIdleEvents||Whether the class uses its internal event loop to process events when the main thread is idle.|
|SelectWaitMillis||The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.|
|UseInternalSecurityAPI||Tells the class whether or not to use the system security libraries or an internal implementation.|