Internet Direct (Indy)
|
Adds a message to the specified mailbox.
function AppendMsg( const AMBName: String; AMsg: TIdMessage; AAlternativeHeaders: TIdHeaderList; const AFlags: TIdMessageFlagsSet = [] ): Boolean; overload;
Parameters |
Description |
AMBName |
Mailbox name used to store the new message. |
AMsg |
Message to be added to the mailbox. |
AAlternativeHeaders |
Alternate headers to use in place of those stored in the message. |
AFlags |
Message flags to apply to the message in the mailbox. Default value is []. |
Boolean - True on success.
AppendMsg is an overloaded Boolean function used to append the message specified in AMsg to the mailbox specified in AMBName. AppendMsg allows the client to perform mailbox maintenance routines like copying and moving messages between mailboxes for the client. AppendMsg copies the contents of the specified TIdMessage instance, including attachments, to the specified mailbox.
AppendMsg implements the IMAP4 APPEND command, and requires that the ConnectionState for the client contain the value csAuthenticated or csSelected. AppendMsg can raise an EIdConnectionStateError exception when the ConnectionState does not contain one of the expected values.
AMBName must contain a valid mailbox name on the IMAP4 server or an EIdConnectionStateError will be raised.
AFlags indicates the set of message flags which should be applied to the message in the mailbox. AppendMsg constructs the flags for the message using MessageFlagSetToStr prior to calling SendCmd using the IMAP4 APPEND command.
AAlternativeHeaders contains alternate RFC-compliant header values to use in place of those stored in the message specified in AMsg. When AAlternativeHeaders isomitted, the message headers found the TIdMessage instance are used when appending message data to the specified mailbox.
AppendMsg creates a temporary file used to calculate the size of the encoded message, including attachments, as required by the IMAP4 APPEND command. The numeric size is updated to reflect the size of the headers specified in AAlternateHeaders, when present.
The APPEND command is sent to the IMAP4 server using the indicated mailbox name, message flags, and the message size as stored in the mailbox. The value in AMBName is enclosed in double quotation marks to prevent errors with mailbox names that include the Space character.
AppendMsg inspects the numeric response code in LastCmdResult, and when the value is IMAP_CONT sends the message headers, body, and attachments in AMsg to the IMAP4 server.
AppendMsg returns False if the APPEND operation is not successfully completed on the IMAP4 server.
Please note that the APPEND command is not used for message delivery, because it does not provide a mechanism to transfer SMTP envelope information.
Use AppendMsgNoEncodeFromFile or AppendMsgNoEncodeFromStream to append a message to a mailbox without encoding message parts prior to transmission.
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. |