Class TMimePart

DescriptionHierarchyFieldsMethodsProperties

Unit

mimepart

Declaration

type TMimePart = class(TObject)

Description

Object for working with parts of MIME e-mail.

Each TMimePart object can handle any number of nested subparts as new TMimepart objects. It can handle any tree hierarchy structure of nested MIME subparts itself.

Basic tasks are:

Decoding of MIME message: - store message into Lines property - call DecomposeParts. Now you have decomposed MIME parts in all nested levels! - now you can explore all properties and subparts. (You can use WalkPart method) - if you need decode part, call DecodePart.

Encoding of MIME message:

- if you need multipart message, you must create subpart by AddSubPart. - set all properties of all parts. - set content of part into DecodedLines stream - encode this stream by EncodePart. - compose full message by ComposeParts. (it build full MIME message from all subparts. Do not call this method for each subpart! It is needed on root part!) - encoded MIME message is stored in Lines property.

Hierarchy

TMimePart > TObject

Methods

Overview

Public constructor Create;
Public destructor Destroy; override;
Public function AddSubPart: TMimePart;
Public procedure Assign(Value: TMimePart);
Public procedure AssignSubParts(Value: TMimePart);
Public function CanSubPart: boolean;
Public procedure Clear;
Public procedure ClearSubParts;
Public procedure ComposeParts;
Public procedure DecodePart;
Public procedure DecodePartHeader;
Public procedure DecomposeParts;
Public procedure DeleteSubPart(index: integer);
Public procedure EncodePart;
Public procedure EncodePartHeader;
Public function GetSubPart(index: integer): TMimePart;
Public function GetSubPartCount: integer;
Public procedure MimeTypeFromExt(Value: string);
Public procedure WalkPart;

Description

Public function AddSubPart: TMimePart;

Add and create new subpart.

Public procedure Assign(Value: TMimePart);

Assign content of another object to this object. (Only this part, not subparts!)

Public procedure AssignSubParts(Value: TMimePart);

Assign content of another object to this object. (With all subparts!)

Public function CanSubPart: boolean;

Return True when is possible create next subpart. (MaxSubLevel is still not reached)

Public procedure Clear;

Clear all data values to default values. It also call ClearSubParts.

Public procedure ClearSubParts;

Clear and destroy all subpart TMimePart objects.

Public procedure ComposeParts;

This part and all subparts is composed into one MIME message stored in Lines property.

Public constructor Create;

 

Public procedure DecodePart;

Decode Mime part from Lines to DecodedLines.

Public procedure DecodePartHeader;

Parse header lines from Headers property into another properties.

Public procedure DecomposeParts;

E-mail message in Lines property is parsed into this object. E-mail headers are stored in Headers property and is parsed into another properties automaticly. Not need call DecodePartHeader! Content of message (part) is stored into PartBody property. This part is in undecoded form! If you need decode it, then you must call DecodePart method by your hands. Lot of another properties is filled also.

Decoding of parts you must call separately due performance reasons. (Not needed to decode all parts in all reasons.)

For each MIME subpart is created new TMimepart object (accessible via method GetSubPart).

Public procedure DeleteSubPart(index: integer);

delete subpart on given index.

Public destructor Destroy; override;

 

Public procedure EncodePart;

Encode mime part from DecodedLines to Lines and build mime headers.

Public procedure EncodePartHeader;

Build header lines in Headers property from another properties.

Public function GetSubPart(index: integer): TMimePart;

Get nested subpart object as new TMimePart. For getting maximum possible index you can use GetSubPartCount method.

Public function GetSubPartCount: integer;

Return number of decomposed subparts. (On this level! Each of this subparts can hold any number of their own nested subparts!)

Public procedure MimeTypeFromExt(Value: string);

generate primary and secondary mime type from filename extension in value. If type not recognised, it return 'Application/octet-string' type.

Public procedure WalkPart;

By calling this method is called OnWalkPart event for each part and their subparts. It is very good for calling some code for each part in MIME message

Properties

Overview

Published property AttachInside: boolean;
Published property Boundary: string;
Published property Charset: string;
Published property CharsetCode: TMimeChar;
Published property ContentID: string;
Published property DecodedLines: TMemoryStream;
Published property DefaultCharset: string;
Published property Description: string;
Published property Disposition: string;
Published property Encoding: string;
Published property EncodingCode: TMimeEncoding;
Published property FileName: string;
Published property Headers: TStringList;
Published property Lines: TStringList;
Published property MaxLineLength: integer;
Published property MaxSubLevel: integer;
Published property OnWalkPart: THookWalkPart;
Published property PartBody: TStringList;
Published property PostPart: TStringList;
Published property PrePart: TStringList;
Published property Primary: string;
Published property PrimaryCode: TMimePrimary;
Published property Secondary: string;
Published property SubLevel: integer;
Published property TargetCharset: TMimeChar;

Description

Published property AttachInside: boolean;

When is True, then this part maybe(!) have included some uuencoded binary data.

Published property Boundary: string;

Boundary delimiter of multipart Mime part. Used only in multipart part.

Published property Charset: string;

String representation of used Mime charset in part. (i.e. 'iso-8859-1') Writing to this property automaticly generate value of CharsetCode. Charset is used only for text parts.

Published property CharsetCode: TMimeChar;

Decoded charset type. Possible values are defined in synachar unit.

Published property ContentID: string;

Content ID.

Published property DecodedLines: TMemoryStream;

Stream with decoded form of budy part.

Published property DefaultCharset: string;

Define default charset for decoding text MIME parts without charset specification. Default value is 'ISO-8859-1' by RCF documents. But Microsoft Outlook use windows codings as default. This property allows properly decode textual parts from some broken versions of Microsoft Outlook. (this is bad software!)

Published property Description: string;

Description of Mime part.

Published property Disposition: string;

Value of content disposition field. (i.e. 'inline' or 'attachment')

Published property Encoding: string;

String representation of used Mime encoding in part. (i.e. 'base64') Writing to this property automaticly generate value of EncodingCode.

Published property EncodingCode: TMimeEncoding;

Decoded encoding type. Possible values are: ME_7BIT, ME_8BIT, ME_QUOTED_PRINTABLE and ME_BASE64. If type not recognised, result is ME_7BIT.

Published property FileName: string;

Filename of file in binary part.

Published property Headers: TStringList;

All header lines of MIME part.

Published property Lines: TStringList;

String list with lines contains mime part (It can be a full message).

Published property MaxLineLength: integer;

Here you can specify maximum line length for encoding of MIME part. If line is longer, then is splitted by standard of MIME. Correct MIME mailers can de-split this line into original length.

Published property MaxSubLevel: integer;

Specify maximum sublevel value for decomposing.

Published property OnWalkPart: THookWalkPart;

Here you can assign hook procedure for walking through all part and their subparts.

Published property PartBody: TStringList;

Encoded form of MIME part data.

Published property PostPart: TStringList;

On multipart this contains part of message between last boundary and end of message.

Published property PrePart: TStringList;

On multipart this contains part of message between first line of message and first boundary.

Published property Primary: string;

Primary Mime type of part. (i.e. 'application') Writing to this property automaticly generate value of PrimaryCode.

Published property PrimaryCode: TMimePrimary;

Decoded primary type. Possible values are: MP_TEXT, MP_MULTIPART, MP_MESSAGE and MP_BINARY. If type not recognised, result is MP_BINARY.

Published property Secondary: string;

Secondary Mime type of part. (i.e. 'mixed')

Published property SubLevel: integer;

Show nested level in subpart tree. Value 0 means root part. 1 means subpart from this root. etc.

Published property TargetCharset: TMimeChar;

System charset type. Default value is charset used by default in your operating system.


Generated by PasDoc 0.8.8.2 on 2005-01-19 20:01:18