MIME Class
Properties Methods Events Configuration Settings Errors
The MIME class allows for the simple encoding and decoding of MIME structures such as message attachments, file uploads, etc.
Syntax
MIME
Remarks
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.
Property List
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 | This property contains the name of the HTTP header (this is the same case as it is delivered). |
MessageHeaderValue | This property contains the header contents. |
MessageHeadersString | String version of the MIME message headers. |
PartCount | The number of records in the Part arrays. |
PartContentDisposition | Content disposition for each part. |
PartContentDispositionAttr | The content disposition's attribute (if any) for each part. |
PartContentId | Content identifier for each part. |
PartContentType | Content type for each part. |
PartContentTypeAttr | The content type attribute, if any, for each part. |
PartDecodedFile | The filename with the decoded data. |
PartDecodedString | This property holds the actual content of each part. |
PartEncoding | This property contains the actual content encoding type for each part. |
PartFilename | This property contains the filename attribute specified in the headers of the part. |
PartHeaders | This property contains the headers for each MIME part. |
PartName | This property contains the name given to a part, such as the filename. |
PartSize | This property contains the size of the DecodedFile or DecodedString . |
Method List
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. |
DecodePart | Decodes the specified part. |
DecodePartToFile | Decodes the specified part to a file on disk. |
EncodeToFile | Encodes to file. |
EncodeToString | Encodes to string. |
Reset | Reset the class. |
ResetData | Resets the values of all headers and Part- properties. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
Header | Fired every time a header is parsed. |
Progress | Shows the progress of decoding/encoding the input data. |
Configuration Settings
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. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |
Boundary Property (MIME Class)
The boundary separating the MIME parts. Maximum length of 80 bytes.
Syntax
QString GetBoundary();
int SetBoundary(QString qsBoundary);
Default Value
""
Remarks
This property contains the boundary separating the MIME parts and has a maximum length of 80 bytes. The class will automatically generate a random boundary value during encoding if no value is given. During decoding this property is filled with the boundary from the actual MIME message.
The class will truncate any string longer than 80 bytes if assigned to Boundary.
Data Type
String
ContentType Property (MIME Class)
The value of the content-type header of the message which was encoded/decoded.
Syntax
QString GetContentType();
int SetContentType(QString qsContentType);
Default Value
""
Remarks
This property contains the value of the content-type header of the message which was encoded/decoded. The class filters it out from the MessageHeaders. It shows the user about the type of the parts and their relation to each other.
The content-type attributes such as filename, boundary, charset etc are held in this property.
Data Type
String
ContentTypeAttr Property (MIME Class)
The attributes for content-type header of the message which was encoded/decoded.
Syntax
QString GetContentTypeAttr();
int SetContentTypeAttr(QString qsContentTypeAttr);
Default Value
""
Remarks
This property contains content-type attributes such as "filename", "boundary", "charset", etc.
Data Type
String
Message Property (MIME Class)
Contains the encoded message text or a path to a file which contains the encoded message text.
Syntax
QByteArray GetMessage();
int SetMessage(QByteArray qbaMessage);
Default Value
""
Remarks
This property contains the encoded message text or a path to a file which contains the encoded message text. The class fills out this property with the message body and MessageHeaders during encoding. The user may assign both the headers and the body to this property and leave MessageHeaders empty before decoding.
This property is not available at design time.
Data Type
Byte Array
MessageHeaderCount Property (MIME Class)
The number of records in the MessageHeader arrays.
Syntax
int GetMessageHeaderCount();
int SetMessageHeaderCount(int iMessageHeaderCount);
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at MessageHeaderCount - 1.This property is not available at design time.
Data Type
Integer
MessageHeaderField Property (MIME Class)
This property contains the name of the HTTP header (this is the same case as it is delivered).
Syntax
QString GetMessageHeaderField(int iMessageHeaderIndex);
int SetMessageHeaderField(int iMessageHeaderIndex, QString qsMessageHeaderField);
Default Value
""
Remarks
This property contains the name of the HTTP Header (this is the same case as it is delivered).
The MessageHeaderIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MessageHeaderCount property.
This property is not available at design time.
Data Type
String
MessageHeaderValue Property (MIME Class)
This property contains the header contents.
Syntax
QString GetMessageHeaderValue(int iMessageHeaderIndex);
int SetMessageHeaderValue(int iMessageHeaderIndex, QString qsMessageHeaderValue);
Default Value
""
Remarks
This property contains the Header contents.
The MessageHeaderIndex parameter specifies the index of the item in the array. The size of the array is controlled by the MessageHeaderCount property.
This property is not available at design time.
Data Type
String
MessageHeadersString Property (MIME Class)
String version of the MIME message headers.
Syntax
QString GetMessageHeadersString();
int SetMessageHeadersString(QString qsMessageHeadersString);
Default Value
""
Remarks
The component fills out MessageHeadersString upon encoding. The user should use them as additional headers when emailing the Message.
This property contains a string version of the MIME message headers. During decoding, if this property is empty the class will try to find the headers in the beginning of the Message and will fill out this property accordingly.
Data Type
String
PartCount Property (MIME Class)
The number of records in the Part arrays.
Syntax
int GetPartCount();
int SetPartCount(int iPartCount);
Default Value
0
Remarks
This property controls the size of the following arrays:
- PartContentDisposition
- PartContentDispositionAttr
- PartContentId
- PartContentType
- PartContentTypeAttr
- PartDecodedFile
- PartDecodedString
- PartEncoding
- PartFilename
- PartHeaders
- PartName
- PartSize
This property is not available at design time.
Data Type
Integer
PartContentDisposition Property (MIME Class)
Content disposition for each part.
Syntax
QString GetPartContentDisposition(int iPartIdx);
int SetPartContentDisposition(int iPartIdx, QString qsPartContentDisposition);
Default Value
""
Remarks
Content disposition for each part.
The value in this property is used in the Content-Disposition header. Typical values include "form-data", "attachment" etc. The class fills it out each time the PartDecodedFile is changed. Changing the PartContentDisposition recalculates the PartHeaders as well.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartContentDispositionAttr Property (MIME Class)
The content disposition's attribute (if any) for each part.
Syntax
QString GetPartContentDispositionAttr(int iPartIdx);
int SetPartContentDispositionAttr(int iPartIdx, QString qsPartContentDispositionAttr);
Default Value
""
Remarks
The content disposition's attribute (if any) for each part.
Typical values for this property are the names of the form-variables while creating an HTTP post, values for filenames etc.
Setting this property recalculates the PartHeaders.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartContentId Property (MIME Class)
Content identifier for each part.
Syntax
QString GetPartContentId(int iPartIdx);
int SetPartContentId(int iPartIdx, QString qsPartContentId);
Default Value
""
Remarks
Content identifier for each part. The value of this property is used in the Content-Id header. The class fills it out each time the PartDecodedFile is changed. Changing This property recalculates the PartHeaders as well.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartContentType Property (MIME Class)
Content type for each part.
Syntax
QString GetPartContentType(int iPartIdx);
int SetPartContentType(int iPartIdx, QString qsPartContentType);
Default Value
""
Remarks
Content type for each part. The value of this property is used in the Content-Type header. Typical values include "image/gif", "text/plain" etc. The class fills it out each time the PartDecodedFile is changed. Changing This property recalculates the PartHeaders as well.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartContentTypeAttr Property (MIME Class)
The content type attribute, if any, for each part.
Syntax
QString GetPartContentTypeAttr(int iPartIdx);
int SetPartContentTypeAttr(int iPartIdx, QString qsPartContentTypeAttr);
Default Value
""
Remarks
The content type attribute, if any, for each part. Setting this recalculates the PartHeaders as well.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartDecodedFile Property (MIME Class)
The filename with the decoded data.
Syntax
QString GetPartDecodedFile(int iPartIdx);
int SetPartDecodedFile(int iPartIdx, QString qsPartDecodedFile);
Default Value
""
Remarks
The filename with the decoded data. Accessing this property for the first time after calling the DecodeFromString or DecodeFromFile method, directs the class to actually decode the part and save the data in a temporary file. The user is responsible for deleting the temporary file.
Setting a value to PartDecodedFile directs the component to calculate the file size and fill out the respective PartSize.
Note: It is recommended to use the DecodePartToFile method instead of querying this property.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartDecodedString Property (MIME Class)
This property holds the actual content of each part.
Syntax
QByteArray GetPartDecodedString(int iPartIdx);
int SetPartDecodedString(int iPartIdx, QByteArray qbaPartDecodedString);
Default Value
""
Remarks
This property holds the actual content of each part. The class decodes the actual part of Message to PartDecodedString when PartDecodedString's value is first queried.
Setting a value to PartDecodedString fills out the corresponding PartSize with the string size if the corresponding PartDecodedFile is empty.
The class checks during encoding first PartDecodedFile: if it is empty then the class uses the value of PartDecodedString.
Note: It is recommended to use the DecodePart method instead of querying this property.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
Byte Array
PartEncoding Property (MIME Class)
This property contains the actual content encoding type for each part.
Syntax
int GetPartEncoding(int iPartIdx);
int SetPartEncoding(int iPartIdx, int iPartEncoding);
Possible Values
PE_7BIT(0),
PE_QUOTED_PRINTABLE(1),
PE_BASE_64(2),
PE_8BIT(3),
PE_BINARY(4),
PE_UUENCODE(5)
Default Value
0
Remarks
This property contains the actual content encoding type for each part. This property determines how to encode the data or how they were actually encoded in the Message as specified in the Content-Transfer-Encoding header.
Possible values for the this property are:
pe7bit (0) | 7 Bit data, no encoding. |
peQuotedPrintable (1) | Quoted-Printable encoding of (typically) text. |
peBase64 (2) | Base64 encoding of binary data. |
pe8Bit (3) | No encoding, 8 Bit characters may be contained as well. |
peBinary (4) | Binary data without any encoding. Similar to 3 (8 Bit encoding). |
peUUEncode (5) | Uuencoding of binary data. |
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
Integer
PartFilename Property (MIME Class)
This property contains the filename attribute specified in the headers of the part.
Syntax
QString GetPartFilename(int iPartIdx);
int SetPartFilename(int iPartIdx, QString qsPartFilename);
Default Value
""
Remarks
This property contains the filename attribute specified in the headers of the part. Changing the value of the corresponding PartDecodedFile sets automatically the PartFilename and consequently the PartHeaders.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartHeaders Property (MIME Class)
This property contains the headers for each MIME part.
Syntax
QString GetPartHeaders(int iPartIdx);
int SetPartHeaders(int iPartIdx, QString qsPartHeaders);
Default Value
""
Remarks
This property contains the headers for each MIME part. The class fills out this property each time any of the other corresponding Part- properties is changed. If additional headers are needed, they should be appended after all the other corresponding Part- properties are set.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartName Property (MIME Class)
This property contains the name given to a part, such as the filename.
Syntax
QString GetPartName(int iPartIdx);
int SetPartName(int iPartIdx, QString qsPartName);
Default Value
""
Remarks
This property contains the name given to a part, such as the filename. Changing the value of PartDecodedFile sets automatically the corresponding PartName and consequently the PartHeaders.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is not available at design time.
Data Type
String
PartSize Property (MIME Class)
This property contains the size of the DecodedFile or DecodedString .
Syntax
int GetPartSize(int iPartIdx);
Default Value
0
Remarks
This property contains the size of the PartDecodedFile or PartDecodedString. If a non empty value is assigned to PartDecodedFile, then class fills out the corresponding PartSize with the file size or an error occurs if the file doesn't exist.
If the PartDecodedFile is empty and a value is assigned to PartDecodedString, then the corresponding PartSize will be equal to the string's size.
During decoding, this property is filled with the size of that part.
The PartIdx parameter specifies the index of the item in the array. The size of the array is controlled by the PartCount property.
This property is read-only and not available at design time.
Data Type
Integer
Config Method (MIME Class)
Sets or retrieves a configuration setting.
Syntax
QString Config(const QString& qsConfigurationString);
Remarks
Config is a generic method available in every class. It is used to set and retrieve configuration settings for the class.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
Error Handling
This method returns a String value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.
DecodeFromFile Method (MIME Class)
Decodes from file.
Syntax
int DecodeFromFile();
Remarks
This method decodes the data file given in Message and optionally MessageHeaders and fills out the Parts properties for each decoded part.
Example (Decoding From File)
MIMEControl.Message = "C:\filename.txt"
MIMEControl.DecodeFromFile
Here, C:\filename.txt must contain the MIME headers and body. If not, the MessageHeaders property must also be set to the appropriate MIME headers.
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
DecodeFromString Method (MIME Class)
Decodes from string.
Syntax
int DecodeFromString();
Remarks
This method decodes from string. Same as DecodeFromFile, but now the Message denotes the real encoded message rather than a filename.
This method decodes the data given in Message and optionally MessageHeaders and fills out the Parts properties.
Example (Decoding Mail Message)
MIMEControl.MessageHeadersString = MailControl.MessageHeaders
MIMEControl.Message = MailControl.MessageText
MIMEControl.DecodeFromString
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
DecodePart Method (MIME Class)
Decodes the specified part.
Syntax
QByteArray DecodePart(int iindex);
Remarks
This method decodes the part specified by Index and returns the decoded part data.
DecodeFromString or DecodeFromFile must be called before calling this method. Calling this method will return the decoded bytes, and in addition the PartDecodedString property will be populated with the string representation of the decoded data.
For instance:
mime.MessageHeadersString = myMessageHeaders;
mime.Message = myMessageBody;
mime.DecodeFromString();
byte[] myPartContent = await mime.DecodePart(0);
Error Handling
This method returns a Binary String value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.
DecodePartToFile Method (MIME Class)
Decodes the specified part to a file on disk.
Syntax
QString DecodePartToFile(int iindex);
Remarks
This method decodes the part specified by Index to a temporary file. The full path to the temporary file is returned by this method. The user is responsible for deleting the temporary file.
DecodeFromString or DecodeFromFile must be called before calling this method.
Error Handling
This method returns a String value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.
EncodeToFile Method (MIME Class)
Encodes to file.
Syntax
int EncodeToFile();
Remarks
This method encodes the data given in Parts properties (either decoded file or decoded string) into a MIME message at Message and MessageHeaders using the values optionally given in Parts properties. To encode several objects into a MIME envelope, the user should first clear any old values left in the Parts properties.
The class will check for each item in Parts properties (first decoded file and then the decoded string) for the data to encode.
The encoded message will be saved in the file pointed to by Message; the message headers will be held by MessageHeaders.
Example (Encoding Data)
MIMEControl.ResetData()
MIMEControl.PartCount = 2
MIMEControl.PartDecodedString(0) = "This is plain text data"
MIMEControl.PartEncoding(0) = peQuotedPrintable
MIMEControl.PartContentType(0) = "text/plain"
MIMEControl.PartDecodedFile(1) = "C:\filename.txt"
MIMEControl.Message = "temp.tmp"
MIMEControl.EncodeToFile()
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
EncodeToString Method (MIME Class)
Encodes to string.
Syntax
int EncodeToString();
Remarks
This method encodes to string. Same as EncodeToFile but the encoded data is held in the Message property rather than saved to a file.
This method encodes the data given in Parts properties into a MIME message. The Message gets stored in Message and MessageHeaders using the values optionally given in Parts properties. To encode several objects into a MIME envelope, the user should first clear any old values left in the Parts properties by calling ResetData.
The class will check each item in Parts properties (first decoded file and then decoded string) for the data to encode.
The encoded message will be stored in the Message property; the message headers will be held by MessageHeaders.
Example (Encoding Data)
MIMEControl.ResetData()
MIMEControl.PartCount = 2
MIMEControl.PartDecodedString(0) = "This is plain text data"
MIMEControl.PartEncoding(0) = peQuotedPrintable
MIMEControl.PartContentType(0) = "text/plain"
MIMEControl.PartDecodedFile(1) = "C:\filename.txt"
MIMEControl.EncodeToString()
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
Reset Method (MIME Class)
Reset the class.
Syntax
int Reset();
Remarks
This method will reset the class's properties to their default values.
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
ResetData Method (MIME Class)
Resets the values of all headers and Part- properties.
Syntax
int ResetData();
Remarks
This method resets the values of all headers and Part- properties. It is an easy way to reset the class's properties before starting to populate the Part- properties with new values.
Error Handling
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)
Error Event (MIME Class)
Information about errors during data delivery.
Syntax
class MIMEErrorEventParams { public: int ErrorCode(); const QString &Description(); int EventRetVal(); void SetEventRetVal(int iRetVal); };
// To handle, connect one or more slots to this signal. void Error(MIMEErrorEventParams *e);
// Or, subclass MIME and override this emitter function. virtual int FireError(MIMEErrorEventParams *e) {...}
Remarks
The Error event is fired in case of exceptional conditions during message processing. Normally the class fails with an error.
ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
Header Event (MIME Class)
Fired every time a header is parsed.
Syntax
class MIMEHeaderEventParams { public: int PartIndex(); const QString &Field(); const QByteArray &Value(); int EventRetVal(); void SetEventRetVal(int iRetVal); };
// To handle, connect one or more slots to this signal. void Header(MIMEHeaderEventParams *e);
// Or, subclass MIME and override this emitter function. virtual int FireHeader(MIMEHeaderEventParams *e) {...}
Remarks
The PartIndex parameter contains the index of the part containing the current header. If the header is from the MIME body, this value will be -1. The Field parameter contains the name of the MIME header. The Value parameter contains the header contents. The Header event is fired when a header is parsed, which occurs for each header of the Message when DecodeFromFile, DecodeFromString, or DecodeFromStream is called.
Progress Event (MIME Class)
Shows the progress of decoding/encoding the input data.
Syntax
class MIMEProgressEventParams { public: int PercentDone(); int EventRetVal(); void SetEventRetVal(int iRetVal); };
// To handle, connect one or more slots to this signal. void Progress(MIMEProgressEventParams *e);
// Or, subclass MIME and override this emitter function. virtual int FireProgress(MIMEProgressEventParams *e) {...}
Remarks
The Progress allows the user to visualize the progress of processing the input data.
The PercentDone parameter shows what percentage of the input has been read.
Configuration Settings (MIME Class)
The class accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these internal properties is provided through the Config method.MIME Configuration Settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DecodeMessageHeaders: Instructs the component to automatically decode message headers.Message headers that have been Quoted-Printable or Base-64 encoded are automatically decoded when this configuration setting is True. The default value of this setting is False. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IncludeHeaders:
Tells the class whether to include the headers when encoding the message.If true, the class will include the headers when EncodeToFile
or EncodeToString are called. If false, only the message will be
encoded.
The default value for IncludeHeaders is false. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RequireVersionHeader: Specifies whether or not the class should require the version header.If true, the class will require that the "MIME-Version" header be included in the MessageHeaders. If the header is not present during decoding, the component fails with an error. This config is false by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SanitizeFilename:
Whether invalid characters are replaced in MIME part filenames.If True, the class will replace invalid characters with an underscore
when decoding the MIME message. This applies to the filename held in
the PartFilename property. When True the following characters are considered invalid:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TempFilePath: If set, the temporary files created during MIME decoding and encoding will be put in the path specified. The TempFilePath property sets the path at which the temporary files will be created. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Base Configuration Settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BuildInfo: Information about the product's build.When queried, this setting will return a string containing information about the product's build. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CodePage:
The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).
The following is a list of valid code page identifiers:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LicenseInfo:
Information about the current license.When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
UseInternalSecurityAPI: Tells the class whether or not to use the system security libraries or an internal implementation. By default the class will use the system security libraries to perform cryptographic functions where applicable. Setting this to true tells the class to use the internal implementation instead of using the system's security API. |
Trappable Errors (MIME Class)
MIME Errors
3 Can't create the file for write (illegal name or disk is write-protected). | |
4 Can't open the file for read (doesn't exist?). | |
5 Can't read from file. | |
6 Can't write to file (disk full?). | |
280 Invalid Part Index. | |
281 Unknown MIME type. | |
282 No MIME-boundary found. | |
283 No file given. | |
284 The class is busy. | |
285 Could not create a temporary file to decode the data. | |
286 Can't read Message file. | |
287 No header separator found. | |
289 No separator found. | |
290 Input stream must have seeking enabled. |