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

## Name

mail::ACCOUNT::moveMessagesTo — Move messages to another folder

## Synopsis

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

`bool ok=mail->moveMessagesTo(` | 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::moveMessagesTo` moves messages in the currently-open folder to another folder. It's similar to mail::ACCOUNT::copyMessagesTo(3x), except that the messages are moved, instead of copied.

`copyTo` is a pointer to a mail::folder object, representing the folder where messages are moved to. `copyTo` may be a folder in another mail account, in which case this function transparently copies the indicated messages using mail::ACCOUNT::copyMessagesTo(3x), then the original messages are removed using mail::ACCOUNT::removeMessages(3x). Only SMAP and maildir-based mail accounts can move messages directly between folders; for all other accounts the copy/delete implementation will be used automatically.

## 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::copyMessagesTo(3x), mail::ACCOUNT::removeMessages(3x).

Prev | Up | Next
mail::ACCOUNT::logout | Home | ToC | mail::ACCOUNT::openFolder