Internet Direct (Indy) Version 9.0.2 Beta
TIdMessage.SaveToFile
Stores message headers and contents in a file.

procedure SaveToFile(AFileName: string);
Parameters
AFileName: string
File to use for storing the message.

Description
SaveToFile is a procedure used to store the headers and contents for the message in the file specified in AFilename. SaveToFile creates a TIdMessageClient instance to be used to store values to AFilename using the Stream-based variant of its ProcessMessage method. If AFilename already exists, it is deleted prior to creation of the TFileStream that writes the message contents.

SaveToFile creates and uses a writable TIdIOHandlerStream instance that is assigned to TIdMessageClient.IOHandler property. The TIdMessageClient instance then opens the write buffer using a 32K buffer size, calls the TIdMessageClient.SendMsg method to perform the operation using the IOHandler, and closes the write buffer.

The TIdMessageClient, TIdIOHandlerStream, and TFileStream class instances are all freed prior to exiting from the method.