Indy 9 | Content | Index | Reference

TIdMessage
Hierarchy, Properties, Methods, Events, See Also, Unit: IdMessage
Encapsulates an Internet Message.

    TIdMessage = class(TIdBaseComponent)

Unit
IdMessage
Description
TIdMessage encapsulates a complete Internet Message as described in the Internet Standards documents:

- RFC 822 - Standard for the Format of ARPA Internet Text Messages (http://www.rfc-editor.org/rfc/rfc822.txt)

- RFC 1036 - Standard for Interchange of USENET Messages (http://www.rfc-editor.org/rfc/rfc1036.txt)

TIdMessage is used with message-based protocols, such as POP3, SMTP, and NNTP. TIdMessage supports Multipurpose Internet Mail Extensions (MIME) as described in the Internet Standards documents:

- RFC 2045 - Multipurpose Internet Mail Extensions (MIME), Part One: Format of Internet Message Bodies (http://www.rfc-editor.org/rfc/rfc2045.txt)

- RFC 2046 - Multipurpose Internet Mail Extensions (MIME), Part Two: Media Types (http://www.rfc-editor.org/rfc/rfc2046.txt)

- RFC 2047 - Multipurpose Internet Mail Extensions (MIME), Part Three: Message Header Extensions for Non-ASCII Text (http://www.rfc-editor.org/rfc/rfc2047.txt)

- RFC 2048 - Multipurpose Internet Mail Extensions (MIME), Part Four: Registration Procedures (http://www.rfc-editor.org/rfc/rfc2048.txt)

- RFC 2049 - Multipurpose Internet Mail Extensions (MIME), Part Five: Conformance Criteria and Examples (http://www.rfc-editor.org/rfc/rfc2049.txt)

TIdMessage.AttachmentEncoding
TIdMessage, See Also
Identifies the default encoding mechanism used for message parts.

    property AttachmentEncoding: string;

Description
AttachmentEncoding is a String property that identifies the encoding mechanism used for attachment message parts in the message. Changing the value of AttachmentEncoding for the message also updates the default encoding used for all message parts in the message.

TIdMessage.BccList
TIdMessage, See Also, Example
Indicates blind carbon copy recipients for the message.

    property BccList: TIdEmailAddressList;

Description
BccList is a TIdEMailAddressList property used to store email address of recipients that will receive a carbon copy of the message, but do not appear in the "To:" headers for the message. BccList is often used for mailing list applications, where members of the mailing list should receive a copy of a message addressed to the list.

Use CCList to indicate message recipients that may appear in the "To:" headers for the message.

TIdMessage.Body
TIdMessage, See Also
Represents the body of the message.

    property Body: TStrings;

Description
Body is a TStrings property that contains the textual values that make up the body of the message. Body normally contains values when the ContentType for the message is a member of the "text/*" MIME family.

When IsEncoded is True, Body contains values that are encoded using the encoding scheme identified in ContentTransferEncoding. When IsEncoded is False, Body contains ASCII text that represents the contents of the message.

When ContentType contains a value in the "multipart/*" MIME family, use MessageParts to access the TIdText or TIdAttachment instances that make up the message.

TIdMessage.CCList
TIdMessage, See Also, Example
Indicates carbon copy recipients for the message.

    property CCList: TIdEmailAddressList;

Description
CCList is a TIdEMailAddressList property used to store the email address of recipients that will receive a carbon copy of the message. Use BccList to indicate recipients that will receive a carbon copy of the message, but do not appear in the "To:" headers for the original message.

TIdMessage.CharSet
TIdMessage
Indicates the character set used for the message.

    property CharSet: string;

Description
CharSet is a String property that indicates the character set used for the message. Some common CharSet values include:

- US-ASCII

- ISO-8859-1

- ISO-8859-2

- ISO-8859-3

- ISO-8859-4

- ISO-8859-5

- ISO-8859-6

- ISO-8859-7

- ISO-8859-8

- ISO-8859-9

- ISO-8859-10

All of these character sets are used as pure 7bit or 8bit sets without any shift or escape functions. The meaning of shift and escape sequences in these character sets is not defined. The "charset" parameter has been defined primarily for the purpose of textual data, and is described in this section for that reason. However, it is possible that non-textual data might also specify a charset value for some purpose.

TIdMessage.ContentDisposition
TIdMessage, See Also
Indicates presentation and storage parameters for the message.

    property ContentDisposition: string;

Description
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 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".

ContentDisposition refers to the presentation and storage parameters for the entire message. Use TIdAttachment.ContentDisposition to access values for a given attachment in MessageParts.

TIdMessage.ContentTransferEncoding
TIdMessage, See Also
Specifies the MIME encoding for the message.

    property ContentTransferEncoding: string;

Description
ContentTransferEncoding is a String property that specifies the MIME encoding used to represent data in a message for transfer using a mail transport protocol. Common values for ContentTransferEncoding include the following:

- 7bit - Message contains 7-bit un-encoded US-ASCII data (Default).

- 8bit - Message contains 8-bit un-encoded data.

- binary - Message contains an un-encoded octet stream.

- quoted-printable - Message contents transformed to 7-bit US-ASCII using quoted-printable encoding algorithm.

- base64 - Message contents transformed to 7-bit US-ASCII using Base64 encoding algorithm.

Use ContentType to determine the original media family and type for a message.

TIdMessage.ContentType
TIdMessage, See Also
Identifies the MIME media type for the message.

    property ContentType: string;

Description
ContentType is a String property that specifies the MIME media type for the message. The purpose of ContentType is to describe the data contained in the body to allow a user agent to determine how to present the data. ContentType contains information about the media type. subtype, and auxillary information in attribute=value notation. Some common values for the media type and subtype include:

- text/plain

- text/html

- text/xml

- text/enhanced

- image/jpeg

- image/gif

- audio/basic

- audio/au

- video/mpeg

- application/octet-stream

- application/postscript

- application/ms-word

- application/ms-excel

- application/rtf

- multipart/mixed

- multipart/alternative

- multipart/parallel

- multipart/related

- message/rfc822

- message/external-body

Use ContentTransferEncoding to identify the encoding scheme for the message.

TIdMessage.Date
TIdMessage, See Also
The date a message was sent.

    property Date: TDateTime;

Description
Date is a TDateTime property that represents the TDateTime, expressed in the local timezone, when the message was sent. For an incoming message, Date contains the value read from the message header "Date:". For an outgoing messsage, Date contains the value written to the message header "Date:", or the current timestamp when UseNowForDate is True.

TIdMessage.Encoding
TIdMessage, See Also
Identifies the encoding algorithm for message attachments.

    property Encoding: TIdMessageEncoding;

Description
Encoding is a TIdMessageEncoding property that represents the value to use for identifying the encoding algorithm for MessageParts in the message. Encoding may contain one of the following values and meanings:

- meMIME - Uses a MIME encoding algorithm.

- meUU - Uses the UUEncode encoding algorithm.

When the value in Encoding is changed, the corresponding textual representation for the algortihm is stored in AttachmentEncoding; for example: "MIME" or "UUE".

Encoding is used in GenerateHeader to insure that ContentType and Charset reflect the values found in attachments stored in MessageParts.

The default value for Encoding is meMIME as assigned in the Create constructor.

TIdMessage.ExtraHeaders
TIdMessage, See Also
Additional headers from the message.

    property ExtraHeaders: TIdHeaderList;

Description
ExtraHeaders is a TIdHeaderList property that contains additional headers for the message. ExtraHeaders is used to store header values from the message that are not represented as properties of TIdMessage. ExtraHeaders is generally used to store values that might be added by a Mail User Agent, or for custom extension tokens beginning with "x-".

TIdMessage.Flags
TIdMessage, See Also
Represents mailbox message flags for the message.

    property Flags: TIdMessageFlagsSet;

Description
Flags is a TIdMessageFlagsSet property that represents state, visibility, and persistence information about a message. Flags can used with components and protocols which provide access to and manuipulation of a mailbox address like TIdPOP3, TTIdIMAP4, TIdPOP3Server, and TIdIMP4Server, or TIdMailbox.

Flags may contain one or more of the enumerated values in TIdMessageFlags.

TIdMessage.From
TIdMessage, See Also
Identifies the original author of the message.

    property From: TIdEmailAddressItem;

Description
From is a TIdEMailAddressItem property that identifies the original author of the message. From may not contain the same value as Sender, when a message is forwarded.

TIdMessage.Headers
TIdMessage, See Also
Header values for the message.

    property Headers: TIdHeaderList;

Description
Headers is a read-only TIdHeaderList property used to store the header values for the message in raw form. Headers is updated in AddHeader and ClearHeader, when message properties represented as header values are updated, or when a message is received by a message client. Headers is used during processing in ProcessHeader and GenerateHeader.

TIdMessage.IsEncoded
TIdMessage
Indicates when the message body is MIME-encoded.

    property IsEncoded: Boolean;

Description
IsEncoded is a Boolean property used to indicate that the message body is encoded with the scheme specified in ContentTransferEncoding.

When IsEncoded is True, use MessageParts to access the text of the message body. When IsEncoded is False, the message body contains ASCII text and can be updated using Body.

TIdMessage.MessageParts
TIdMessage
List of message parts for the message.

    property MessageParts: TIdMessageParts;

Description
MessageParts is a TIdMessagePartsList used to store the TIdMessagePart components that make up the message. MessageParts can contain two TIdMessagePart descendants: TIdText and TIdAttachment.

MessageParts is used when IsEncoded is set to True (on sending), or NoDecode is set to false for receiving.

TIdMessage.MIMEBoundary
TIdMessage, See Also
Represents MIME boundary markers for the message.

    property MIMEBoundary: TIdMIMEBoundary;

Description
MIMEBoundary is a TIdMIMEBoundary property that represents the container for boundary marker strings used in the message. MIMEBoundary contents are in reverse order of their usage in the message. MIMEBoundary is updated when headers are processed from an incoming message, or when message parts are written to the output stream by a message client.

TIdMessage.MsgId
TIdMessage, See Also
Message identifier assigned to the message.

    property MsgId: string;

Description
MsgID is a String property that represents the unique message identifier for the message. MsgID contains the value from the RFC message header 'Message-Id:'. MsgID is normally assigned by the server that receives the message.

TIdMessage.NewsGroups
TIdMessage
Identifies newsgroup to receive the message.

    property NewsGroups: TStrings;

Description
NewsGroups is a TStrings property that is used to store the Newsgroup names where the message should be posted. Newsgroups is used to construct the value for the RFC message header 'Newsgroups:'. Newsgroups is significant when the message is retrieved or posted using a NNTP client.

TIdMessage.NoDecode
TIdMessage
Requests a message in raw form.

    property NoDecode: Boolean;

Description
NoDecode is a Boolean property used to indicate that the message should be retrieved without decoding the contents of the message. The default value of NoDecode is False.

When NoDecode is True, the message will be retrieved and added to MessageParts as MIME-encoded attachments. There will be one MessagePart (TIdText type) added for the message Body, and additional MessagePart items (TIdAttachment type) for each message attachment. Body will be empty.

To read a message for a POP3 client, you can use the following code:

        Msg.NoDecode := false;
        APOP.Retrieve(1, Msg);

        for i := 0 to Pred(Msg.MessageParts.Count) do
        begin
          //general attachments
          if (Msg.MessageParts.Items[i] is TIdAttachment) then
          begin
            lstAttachments.Add(TIdAttachment(Msg.MessageParts.Items[i]).Filename);
          end

          //body text
          else
          begin
            if Msg.MessageParts.Items[intIndex] is TIdText then
            begin
              Memo1.Lines.AddStrings(TIdText(Msg.MessageParts.Items[i]).Body);
            end
          end;
        end;

When NoDecode is False, the message will be retreived and the message body is stored in Body in its MIME-encoded form.

TIdMessage.NoEncode
TIdMessage, See Also
Indicates if encoding can be omitted for Headers and Body prior to message transmission.

    property NoEncode: Boolean;

Description
NoEncode is a Boolean property that indicates if encoding should be performed when sending message headers and other content. NoEncode can be used when the TIdMessage instance has been loaded using values that have already been encoded, or require no encoding prior to transmission.

The default value for NoEncode is ID_MSG_NODECODE as assigned in the Create constructor. NoEncode is used in TIdMessageClient.SendMsg. When NoEncode is True, Headers and the optional Body for the message will be written by the message client using WriteStrings. Note: When NoEncode is True, other message parts for the message are not sent by the message client.

TIdMessage.Organization
TIdMessage, See Also
Identifies the organizational affiliation for the message author.

    property Organization: string;

Description
Organization is a String property that identifies the organizational affiliation for the message author. Organization is the value from the RFC message header 'Organization:'.

TIdMessage.Priority
TIdMessage
Identifies the message priority.

    property Priority: TIdMessagePriority;

Description
Priority is a TIdMessagePriority property that describes the message priority. Priority can contain one of the following values:

- mpHighest - The message should be given the highest priority

- mpHigh - This message should be given a high priority

- mpNormal - This message should be given the normal priority. This is the default value.

- mpLow - This message should be given a low priority

- mpLowest - This message should be given the lowest priority

TIdMessage.ReceiptRecipient
TIdMessage, See Also
Return receipt email address.

    property ReceiptRecipient: TIdEmailAddressItem;

Description
ReceiptRecipient is a TIdEMailAddressItem property used to identify the address where a return receipt for the message should be delivered. Assign a blank value to ReceiptRecipient when a return receipt is not desired.

TIdMessage.Recipients
TIdMessage, See Also
Identifies the recipients of a message.

    property Recipients: TIdEmailAddressList;

Description
Recipients is a TIdEMailAddressList property used to store TIdEmailAddressItem values that identify the recipients of the message. Use CCList for recipients to receive a Carbon Copy of the message. Use BCCList for recipients to receive a Blind Carbo Copy of the message.

TIdMessage.References
TIdMessage
Identifies the reply-to messages.

    property References: string;

Description
References is a String property that contains a list of message identifiers for which the message is a reply. References contains the value for the RFC message header 'References:'.

References is used by NNTP newsreader applications to create a threaded article display.

TIdMessage.ReplyTo
TIdMessage
Identifies the delivery address for message replies.

    property ReplyTo: TIdEmailAddressList;

Description
ReplyTo is a TIdEmailAddressItem property that specifies the email address where replies to this message should be delivered. ReplyTo is used when the delivery address is different that From. ReplyTo contains the value from the RFC message header 'Reply-To'.

TIdMessage.Sender
TIdMessage, See Also
Identifies the sender of the message.

    property Sender: TIdEmailAddressItem;

Description
Sender is a TIdEMailAddressItem property used to indicate the person sending the message, if the person is not the message author. Sender contains the value from the RFC message header 'Sender:'. Use From to access the original author of the message.

TIdMessage.Subject
TIdMessage, See Also
Identifies the subject for the message.

    property Subject: string;

Description
Subject is a String property that identifies the subject for the message. Subject contains the value from the RFC message header 'Subject:'.

TIdMessage.UID
TIdMessage, See Also
Unique Identifier for a message.

    property UID: String;

Description
UID is a String property that represents the Unique Identifier message attribute assigned to a message in mail-related protocols like IMAP4 and POP3. The content and format of UID is based on requirements in the mail protocol.

For messages retrieved using TIdIMAP4, UID will contain the string representation of the persistent 32-bit integer value stored in mailbox data associted with the message envelope. The value in UID is assigned when a message instance is created and updated in the message collection used in TIdIMAP4.UIDRetrieveAllEnvelopes.

For messages retrieved using TIdPOP3, UID may contain the arbitrary 70-byte value (maximum) which identifies a message in the POP3 maildrop. In POP3, individual byte values in UID must be in the range 0x21 to 0x7E. Note: Messages marked as deleted in the POP3 maildrop are not returned with a UID value.

TIdMessage.UseNowForDate
TIdMessage, See Also
Indicates that the message uses the current date and time when sent.

    property UseNowForDate: Boolean;

Description
UseNowForDate is a Boolean property that indicates the message should use the current date and time in the Date property when the message is sent to the server.

TIdMessage.AddHeader
TIdMessage, See Also
Adds a header and value to the message.

    procedure AddHeader(const Value: string);

Parameters
const Value: string
header name and value in NAME=VALUE form.
Description
AddHeader is a procedure used to add a header name and value to the Header for the message. Value is the RFC 822 message header to be added in NAME=VALUE form.

AddHeader can be used to add an experimental header after the message has loaded the header values in TIdMessageClient and set property values using ProcessHeaders.

Note: AddHeader does not perform line folding for header values.

TIdMessage.Clear
TIdMessage
Clears the header and body for the message.

    procedure Clear; virtual;

Description
Clear is a procedure used to clear the values stored in the Header and Body of the message.

Clear calls ClearHeader to remove the contents of the message header. Clear calls ClearBody to remove the contents of the message body.

TIdMessage.ClearBody
TIdMessage, See Also
Clear the contents of the message body.

    procedure ClearBody;

Description
ClearBody is a procedure used to clear the contents of the message. ClearBody will insure that text lines in Body are remove by calling Body.Clear. ClearBody also removes any items in the MessageParts collection by calling MessageParts.Clear.

Use ClearHeader to remove the contents the message Header, or Clear to remove both the Header and the Body of the message.

TIdMessage.ClearHeader
TIdMessage, See Also
Clear the contents of the message header.

    procedure ClearHeader;

Description
ClearHeader is a procedure used to clear the contents of the message Header. ClearHeader will reset properties to their default values, including:

- CcList

- BccList

- Date

- From

- NewsGroups

- Organization

- References

- ReplyTo

- Subject

- Recipients

- Priority

- ReceiptRecipient

- ContentType

- CharSet

- ContentTransferEncoding

- ContentDisposition

- Sender

- Headers

- ExtraHeaders

- MIMEBoundary

- UseNowForDate

- Flags

Use ClearBody to remove the contents the message Body, or Clear to remove both the Header and the Body of the message.

TIdMessage.Create
TIdMessage, See Also
Constructor for the object instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method to initialize the object instance. Create also initializes object properties for the instance, including:

- Body

- Recipients

- BccList

- CcList

- MessageParts

- NewsGroups

- Headers

- From

- ReplyTo

- Sender

- ExtraHeaders

- ReceiptRecipient

- MIMEBoundary

- NoDecode

Create also calls Clear to insure that Headers and Body are reset to their empty state.

TIdMessage.Destroy
TIdMessage, See Also
Frees the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for the object instance. Destroy is responsible for freeing the object references used in internal properties, as initiated in the Create constructor.

Destroy calls the inherited Destroy method to complete destruction of the object instance.

TIdMessage.GenerateHeader
TIdMessage, See Also
Create a list of headers for the message.

    function GenerateHeader: TIdHeaderList;

Return Value
TIdHeaderList - Headers generated for the message.
Description
GenerateHeader is a TIdHeaderList function used to create and populate a MIME-encoded list of message headers. The message headers returned by GenerateHeader includes:

- From

- Subject

- To

- Cc

- Newsgroups

- Content-Type

- MIME-Version

- Content-Transfer-Encoding

- Sender

- Reply-To

- Organization

- Disposition-Notification-To

- References

- Date

- X-Priority

- X-Library

For the Content-Type header, GenerateHeader compares the MIME Encoding for the message to the message encoders used for any MessageParts. If a message encoder contains a Charset value, it is appended to ContentType. If Ecoding contains a value other than meMIME, and the message has multipart/related or multipart/alternative message parts, an EIdMessageException will be raised.

GenerateHeader appends all values in ExtraHeaders to the TIdHeaderList return value. The application must free the TIdHeaderList returned by GenerateHeader.

TIdMessage.GetUseNowForDate
TIdMessage, See Also
Reads the Boolean value for UseDateForNow.

    function GetUseNowForDate: Boolean;

Description
GetUseNowForDate is the Read access specifier for the Boolean UseDateForNow property.

TIdMessage.LoadFromFile
TIdMessage
Loads message headers and message parts from a file.

    procedure LoadFromFile(const AFileName: string; const AHeadersOnly: Boolean = False);

Parameters
const AFileName: string
File containing values to load into the message.
const AHeadersOnly: Boolean = False
Message should load only headers from the file.
Description
LoadFromFile is a procedure that loads the headers and optional contents for a message from the file name specified in AFilename. If AFilename is not a valid file name on the the local file system, an EIdMessageCannotLoad exception will be raised and the method will be aborted.

LoadFromFile creates an instance of TFileStream to be used to reading the values for the message instance. The file stream is created using the file mode constants fmOpenRead and fmShareDenyWrite. LoadFromFile calls LoadFromStream using the stream to perform the physical input operation. The TFileStream instance is freed prior to exiting from the method.

When AHeadersOnly is False, only header values up to and including the blank line delimiter in RFC message headers will be read from the input file. When AHeadersOnly is True, both message Headers and MessageParts will be read into the message instance.

Use SaveToFile to create a file suitable for use with LoadFromFile. Use LoadFromSteam to read message contents from a TStream descendant. Use SaveToStream to create a stream containing values suitable for use with LoadFromSteam.

Note: Both LoadFromFile and LoadFromStream are designed to handle messages written using the SaveToStream or SavedToFile methods in the Indy TIdMessage component. These methods create an encoded version of the message contents that matches the protocol tranmissions used when the message is transmitted using TIdSMTP including the message terminator characters (CRLF.CRLF). If you are trying to import .EML message files from MS Outlook Express, or another email client, make sure that the text file contains the message terminator sequence. An exception will be raised if LoadFromFile or LoadFromStream are used to load files that do not include the message terminator sequence.

TIdMessage.LoadFromStream
TIdMessage, See Also
Loads message headers and message parts from an input stream.

    procedure LoadFromStream(AStream: TStream; const AHeadersOnly: Boolean = False);

Parameters
AStream: TStream
Source used to read headers and message parts.
const AHeadersOnly: Boolean = False
Indicates if only headers should be loaded. Default value is False.
Description
LoadFromStream is a procedure that allows loading of headers and optional message parts for the TIdMessage instance from the stream identified in AStream.

AStream is a TStream descendant and represents the data source that will be used read values to be stored in the message instance. AStream can be any TStream descendant suitable for use in the as the input stream in a TIdIOHandlerStream instance. Note: The current position in AStream is not changed at any time during the LoadFromStream method. LoadFromStream uses the current stream position to perform the physical input operation, and leaves the stream at the position following the read operation.

AHeadersOnly indicates if only message headers should be loaded for the message instance. When AHeadersOnly is False, the entire message including all Headers and MessageParts will be loaded from AStream.

LoadFromStream creates an instance of TIdMessageClient, and calls TIdMessageClient.ProcessMessage to perform the physical input required to load values into the message instance. The TIdMessageClient instance is freed prior to exiting from the method.

Note: Both LoadFromFile and LoadFromStream are designed to handle messages written using the SaveToStream or SavedToFile methods in the Indy TIdMessage component. These methods create an encoded version of the message contents that matches the protocol tranmissions used when the message is transmitted using TIdSMTP including the message terminator characters (CRLF.CRLF). If you are trying to import .EML message files from MS Outlook Express, or another email client, make sure that the text file contains the message terminator sequence. An exception will be raised if LoadFromFile or LoadFromStream are used to load files that do not include the message terminator sequence.

TIdMessage.ProcessHeaders
TIdMessage
Updates message properties based on header values in the message.

    procedure ProcessHeaders;

Description
ProcessHeaders is a procedure that updates message properties based on header values in the message. ProcessHeaders examine the TIdHeaderList property Headers to retrieve values that can be expressed as TIdMessage properties, including the following:

- CCList

- ContentDisposition

- ContentTransferEncoding

- ContentType

- Date

- From

- MIMEBoundary

- MsgId

- Newsgroups

- Organization

- Priority

- ReceiptRecipient

- Recipients

- References

- ReplyTo

- Sender

- Subject

TIdMessage.SaveToFile
TIdMessage
Stores message headers and contents in a file.

    procedure SaveToFile(const AFileName: string; const AHeadersOnly: Boolean = False);

Parameters
const AFileName: string
File to use for storing the message.
const AHeadersOnly: Boolean = False
Message should store only headers to the file.
Description
SaveToFile is a procedure used to store the headers and optional message parts for the message in the file specified in AFilename. If the file specified in AFileName already exists, the file is deleted prior to performing any output operation. SaveToFile calls SaveToStream using the file stream to perform the physical output operation. The file stream instance is freed prior to exiting from the method.

TIdMessage.SaveToStream
TIdMessage, See Also
Stores message headers and message parts to an output stream.

    procedure SaveToStream(AStream: TStream; const AHeadersOnly: Boolean = False);

Parameters
AStream: TStream
Destination used to write headers and message parts.
const AHeadersOnly: Boolean = False
Indicates if only headers should be stored. Default value is False.
Description
SaveToStream is a procedure that allows storage of headers and optional message parts for the TIdMessage instance to the stream identified in AStream.

AStream is a TStream descendant and represents the destination that will be used to write values in the message instance. AStream can be any TStream descendant suitable for use as the output stream in a TIdIOHandlerStream instance. Note: The current position in AStream is not changed at any time during the SaveToStream method. SaveToStream uses the current stream position to perform the physical output operation, and leaves the stream at the position following the write operation.

AHeadersOnly indicates if only message headers should be written for the message instance. When AHeadersOnly is False, the entire message including all Headers and MessageParts will be stored in AStream.

SaveToStream creates an instance of TIdMessageClient, and calls TIdMessageClient.SaveMsg to perform the physical output required to store values from the message instance. The TIdMessageClient instance is freed prior to exiting from the method.

TIdMessage.SetBody
TIdMessage, See Also
Updates the message body to the specified contents.

    procedure SetBody(const Value: TStrings);

Parameters
const Value: TStrings
Data to be assigned to the message body.
Description
SetBody is a procedure that updates the message body to the specified contents. SetBody is the write specifier for the Body property.

TIdMessage.SetExtraHeaders
TIdMessage, See Also
Updates the contents of the ExtraHeaders property to the specified values.

    procedure SetExtraHeaders(const Value: TIdHeaderList);

Parameters
AValue
Contents to assign to the extra headers list.
Description
SetExtraHeaders is a procedure that updates the contents of the ExtraHeaders property to the specified values.

TIdMessage.SetNewsGroups
TIdMessage, See Also
Updates the contents of the Newsgroup property to the specified values.

    procedure SetNewsGroups(const Value: TStrings);

Parameters
const Value: TStrings
Contents to be assigned to the newsgroup property.
Description
SetNewsGroups is a procedure that updates the contents of the NewsGroup property to the specified values.

TIdMessage.SetUseNowForDate
TIdMessage, See Also
Updates the Boolean value for UseDateForNow.

    procedure SetUseNowForDate(const Value: Boolean);

Description
SetUseNowForDate is the write access specifier for the Boolean UseNowForDate property.

TIdMessage.OnInitializeISO
TIdMessage, See Also

    property OnInitializeISO: TIdInitializeIsoEvent;

Description
OnInitializeISO is a TIdInitializeIsoEvent property that represents the event handler signalled when ... ???? OnInitializeISO is signalled during excecution of GenerateHeader.

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