Internet Direct (Indy)
Home
PreviousUpNext
TIdAttachment.PrepareTempStream Method

Provides a stream for the contents of the message part.

Pascal
function PrepareTempStream: TIdStream; virtual; abstract;

TStream - Stream containing the contents for the message part.

PrepareTempStream is an virtual abstract TStream function that specifies the method used to obtain a stream containing data for the message part. 

PrepareTempStream is called when loading or receiving a message with attachments. When a TIdMessage instance is received and processed using TIdMessageClient, or a descendant class, the overridden PrepareTempStream and FinishTempStream methods for the 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, loading a message and receiving a message are the same - differing only in the type of stream used to read the message contents. 

PrepareTempStream ensures that the temporary stream used for processing the contents of the message part are allocated, sized, and/or positioned prior to reading values to be stored in a TIdMessage instance. 

Use FinishTempStream to ensure that the temporary stream used for processing the contents of the message part is freed, and/or repositioned after reading values stored in the message part. 

The ProcessMessage, ReceiveHeader, and ReceiveBody methods in TIdMessageClient rely on the overridden methods. 

PrepareTempStream must be overridden in a descendant class, like TIdAttachmentFile or TIdAttachmentMemory, to implement creating or positioning the stream as required for the message part.

TIdAttachmentFile.PrepareTempStream 

TIdAttachmentMemory.PrepareTempStream 

TIdMessage.LoadFromFile 

TIdMessage.ProcessMessage 

TIdMessage.ReceiveHeader 

TIdMessage.ReceiveBody

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.