Command IMAP_CopyToMB

4D Internet Commands

IMAP_CopyToMB

version 6.8.1


IMAP_CopyToMB (imap_ID; startMsg; endMsg; mbNameTarget{; msgDelete}) Integer

ParameterTypeDescription
imap_IDLongintReference to an IMAP login
startMsgLongintStart message number
endMsgLongintEnd message number
mbNameTargetTextName of the destination mailbox
msgDeleteInteger0= Do not remove from source mailbox,
1= Remove from source mailbox

Function result Integer Error code

Description

Given a range of messages from startMsg to endMsg, the IMAP_CopyToMB command will copy the specified message(s) to the end of the specified mbNameTarget destination mailbox. The flags and the internal date of the message(s) are usually preserved in the destination mailbox, depending on the IMAP server implementation.

After being copied, original messages are not removed from the source mailbox. If you want to remove them, you can use one of the 3 following processes:

• use the IMAP_Delete command,

• set the msgDelete optional parameter to 1,

• set IMAP_SetFlags (\Deleted): the messages will be removed when the session is closed.

Note: The msgDelete parameter will force the execution of an IMAP_Delete; therefore, the deletion will include messages between startMsg and endMsg and ALL messages for which the \Deleted flag is set.

If the destination mailbox does not exist, an error is returned.

imap_ID is a long integer reference to an open connection created with IMAP_Login.

startMsg is a long integer number that specifies the starting message number of the message range to be copied. The message number is a value representing the position of a message within the list of all messages in the mailbox identified by imap_ID.

endMsg is a long integer number that specifies the ending message number of the message range to be copied. The message number is a value representing the position of a message within the list of all messages in the mailbox identified by imap_ID.

Note: The IMAP_Delete, IMAP_MsgLstInfo, IMAP_MsgLst, IMAP_SetFlags, IMAP_GetFlags and IMAP_CopyToMB commands do not return an error if the startMsg is greater than the endMsg. In the event that this occurs, the command – in effect – does nothing.

mbNameTarget is the full name of the mailbox where the specified messages will be copied.

The msgDelete optional parameter allows setting if you want to remove the message from the source mailbox.

• 0= Do not remove from source mailbox (default value);

• 1= Remove from source mailbox.

If msgDelete is omitted, the default value is used.

If copying fails, the message is not removed from the source mailbox.

If the user does not have access to remove messages, an error message is generated.

See Also

IMAP_CreateMB, IMAP_ListMBs, IMAP_RenameMB.