mail::ACCOUNT::copyMessagesTo
Prev | mail::ACCOUNT Synchronous API reference | Next

## Name

mail::ACCOUNT::copyMessagesTo — Copy messages to another folder

## Synopsis

#include <libmail/sync.H>
mail::ACCOUNT *mail;
mail::folder *folder;

`bool ok=mail->fsfunccopyMessagesTo(` | const std::vector<size_t> &msgList,
| mail::folder *copyTo`)`;

std::string errmsg=mail->getErrmsg();

## USAGE

`msgList` specifies a list of messages. Messages are numbered starting with message #0 and up to one less than mail::ACCOUNT::getFolderIndexSize(3x) (when `mail::account::getFolderIndexSize` returns 6, the messages are numbered 0 through 5). Only the messages that appear in `msgList` are processed by this request. When a message is removed from the folder, by mail::ACCOUNT::updateFolderIndexInfo(3x), the following messages are renumbered accordingly.

### Note

Most mail servers allow multiple applications to open the same folder. Therefore, changes to the folder's contents can occur at any time. Before making this request, the application should use mail::ACCOUNT::checkNewMail(3x) to verify that no unexpected changes have been made to the folder's contents.

`mail::ACCOUNT::copyMessagesTo` copies messages in the currently-open folder to another folder. `copyTo` is a pointer to a mail::folder object, representing the folder where messages are copied to. If `account` is an IMAP account and `copyTo` is another folder in the same account, then the messages are quickly copied by the IMAP server. Otherwise each message is individually downloaded and copied to the `copyTo` folder.

## Return Codes

This method returns `true` if it succeeds, or `false` if it fails. If the method fails, use `mail::ACCOUNT::getErrmsg()` to read a brief description of the error.

## SEE ALSO

mail::ACCOUNT::moveMessagesTo(3x), mail::ACCOUNT::searchMessages(3x).

Prev | Up | Next
mail::ACCOUNT::checkNewMail | Home | ToC | mail::ACCOUNT::createFolder