Indy 9
Hierarchy, Properties, Methods, Events, See Also, Unit: IdMessage
Encapsulates a MIME-encoded attachment or inline graphic.
TIdAttachment = class(TIdMessagePart)
TIdAttachment is a TIdMessagePart descendant that encapsulates a MIME-encoded attachment or inline graphic. TIdAttachment and TIdText are used as collection items in a TIdMessageParts collection.

TIdAttachment provides methods and properties relevant to Internet Message attachments including ContentDisposition, FileName, and SaveToFile. TIdAttachment also reintroduces the Create constructor to specify the owner Collection and the file used to store the attachment. TIdAttachment also provides an Encode method to allow encoding of a message part to a TStream descendant.

Indicates presentation and storage parameters for the message part.
property ContentDisposition: string;
ContentDisposition is a String property that represents the value for the Internet Message header "Content-Disposition" as described in RFC 2183. ContentDisposition indicates presentation information for the message part and can contain values and optional parameters.

ContentDisposition can contain the value "inline" for an Internet Message where the body part should be display immediately, and in the order in which it occurs.

ContentDisposition can contain the value "attachment" followed by additional parameters to indicate that the message part is separate from the main body of the message. The parameter "filename" can be used to suggest a filename where the message part is detached and stored in a separate file. Other parameters can include "creation-date", "modification-date", "read-date", and "size".

When ContentDisposition contains "attachment", the FileName property reflects the file where the message part is stored.

TIdAttachment, See Also
Indicates the storage for the message part is a temporary file.
property FileIsTempFile: boolean;
FileIsTempFile is a Boolean property that indicates that storage file indicated in FileName is a temporary file. FileIsTempFile is used in Destroy to determine if the storage file should be deleted when the object instance is freed.

TIdAttachment, See Also
File name used to the store the attachment.
property FileName: TFileName;
FileName is a String property that represents the file name where the message part is stored. FileName contains the parameter value from the Internet Message header "Content-Dispositon: attachment; filename=".

Set FileIsTempFile to True to indicate that the file should be deleted when the attachment is freed in Destroy.

Copy the property values from an object to the current instance.
procedure Assign(Source: TPersistent); override;
Source: TPersistent
Persistent class that contains values to be copied.
Assign is a procedure used to store the properties values from the object instance specified by Source in the current object instance. If source is an instance of the same ClassType as the current object, Assign will copy the value of the following properties:

When Source is not the same ClassType as the current object instance, Assign calls the inherited Assign method.

Constructor for the collection item.
constructor Create(Collection: TIdMessageParts; const AFileName: TFileName = ''); reintroduce;
Collection: TIdMessageParts
Collection that owns the collection item.
const AFileName: TFileName = ''
File name for the attachment. Default values is ''.
Create is the constructor for the collection item, and is used to create a new TIdAttachment object and add it to the TIdMessageParts collection specified by the Collection parameter.

AFileName is an optional parameter that specifies the initial name of the file to be attached with the TIdAttachment.

Create calls the inherited Create method to initialize the object instance, and assigns AFileName to the FileName property.

TIdAttachment, See Also
Destructor for the object instance.
destructor Destroy; override;
Destroy is the Destructor for the object instance. If the FileIsTempFile property contains True, Destroy calls DeleteFile using the Filename property to remove the temporary file for the attachment. Destroy calls the inherited method to finalize destruction of the object instance.

TIdAttachment, See Also
procedure Encode(ADest: TStream);
ADest: TStream
Stream to receive the encoded value for the message part.
Encode is a procedure used to create and store the encoded values for a message part in the TStream identified by ADest. Encode uses the TIdMessageEncoderInfo for the owner Collection to create an encoder instance for the message part, which reads the message part from the stored file and captures the values in the specified stream.

Stores a message part to a disk file.
function SaveToFile(const FileName: TFileName): Boolean;
const FileName: TFileName
File name where the message part will be stored.
Return Value
Boolean - True when the message parts is stored.
SaveToFile is a Boolean function used to store the attachment that represents the message part to the file specified in Filename.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.