Topic Path: Symbol Reference > Classes > TIdIMAP4 Class > TIdIMAP4 Methods > CopyMsgs Method
TIdIMAP4.CopyMsgs Method

Copies the indicated messages from the current mailbox to a specified mailbox.

function CopyMsgs(
    const AMsgNumList: array of Integer; 
    const AMBName: String
): Boolean;
Array of relative message numbers for messages to be copied.
target mailbox name on the IMAP4 server. 

Boolean - True on success.

CopyMsgs is a Boolean function used to copy a list of relative message numbers in the currently selected mailbox to another mailbox on the IMAP4 server. 

AMsgNumList is an Array of relative message numbers for messages to be copied. If the length of the array is 0, no action is performed and the method is exited. 

AMBName is the target mailbox on the IMAP4 server where a copy of the message will be stored. AMBName must represent an existing mailbox on the IMAP4 server that is valid for the currently connected Username and Password

Use of CopyMsgs requires that a mailbox be previously selected using the SelectMailbox method, and that ConnectionState contains the value csSelected, or an EIdConnectionStateError exception will be raised. 

CopyMsgs calls SendCmd to send the IMAP4 COPY command using the list of message numbers and the value in AMBName. AMBName is UTF7-encoded prior to transmission. 

The return value for the method is True on successful completion of the IMAP4 COPY command. 

Use CopyMsg to copy a single message to a specified mailbox. 

Use UIDCopyMsg or UIDCopyMsgs to copy messages in the currently selected mailbox using unique identifier(s) instead of relative message number(s).

With the message RSIMAP4ConnectionStateError
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.