Encapsulates a MIME-encoded attachment or inline graphic using in-memory storage.
TIdAttachmentMemory = class(TIdAttachment);
TIdAttachmentMemory is a TIdAttachment descendant that implements a MIME-encoded attachment or inline graphic using in-memory storage for the contents of the message part.
TIdAttachmentMemory publishes properties that provide access to memory used to store the message part using string- or stream-based access methods.
TIdAttachmentMemory implements an internal TMemoryStream stream used to read or write the contents of the message part during transmission and receipt.
TIdAttachmentMemory implements the abstract virtual methods from TIdAttachment needed to retrieve and store the contents of the message part using a stream.
For sending a message with attachments, the following abstract virtual methods are overridden and reimplemented:
The Create constructor is overloaded to accept either a string or stream argument that contains the contents of the attachment.
OpenLoadStream creates a stream used for loading the contents of the message part. During transmission, values in the internal stream are encoded based on the properties specified in the message or message part in TIdMessageClient methods like SendHeader and SendBody.
CloseLoadStream ensures that the internal stream for accessing data in the message part is reset to its initial position when all values have been read during transmission.
When loading or receiving a message with in-memory attachments, the following abstract virtual are overridden and reimplemented:
When a TIdMessage instance is received and processed using TIdMessageClient, or a descendant class, the overridden PrepareTempStream and FinishTempStream methods for the in-memory attachment are called. These methods apply to both receiving a message from a remote mail server or accessing a message from a local mail store. Essentially, the actions are the same - differing only in the type of stream used to read the message contents.
The ProcessMessage, ReceiveHeader, and ReceiveBody methods in TIdMessageClient rely on the overridden methods.
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.