Internet Direct (Indy)
Home
PreviousUpNext
TIdIMAP4.CopyMsg Method

Copies a message from the current mailbox to a specified mailbox.

Pascal
function CopyMsg(
    const AMsgNum: Integer; 
    const AMBName: String
): Boolean;
Parameters 
Description 
AMsgNum 
relative message number for the message in the currently selected mailbox.
 
AMBName 
target mailbox name on the IMAP4 server. 

Boolean - True on success.

CopyMsg is a Boolean function used to copy a message in the currently selected mailbox to another mailbox on the IMAP4 server. 

AMsgNum is the relative message number for the message in the currently selected mailbox. 

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

CopyMsg performs validation for the value in AMsgNum, and can raise an EIdNumberInvalid exception if the message number contains zero or a negative number. 

Use of CopyMsg 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. 

CopyMsg calls SendCmd to send the IMAP4 COPY command using the values indicated in AMsgNum and 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 CopyMsgs to copy multiple message numbers 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).

Exceptions 
Description 
With the message RSIMAP4NumberInvalid
With the message RSIMAP4ConnectionStateError
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.