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

## Name

mail::ACCOUNT::openFolder — Open a folder

## Synopsis

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

`bool ok=mail->openFolder(` | const mail::folder *folder`)`;

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

## USAGE

A mail folder must be formally "opened" before the messages in the folder may be accessed. Each mail account can have only one mail folder at any time Opening another folder automatically "closes" the previous folder.

### Note

Different mail::account or mail::ACCOUNT objects may each have a folder opened, at the same time. It is possible to create multiple mail::account or mail::ACCOUNT objects that refer to the same actual mail account. Whether it is possible to access the same account multiple times, using different objects, and whether each object may have the same folder opened depends on the account type and/or the remote server.

- Whether it's possible to open the same remote IMAP or POP3 account more than once depends on the remote IMAP/POP3 server.

- Whether it's possible to open the same folder on a remote IMAP server account more than once depends on the remote IMAP/POP3 server. Most IMAP servers allow the same account to be opened more than once, as long as the different login sessions do not try to open the same folder. Some IMAP servers allow the same folder to be opened simultaneously by multiple sessions.

- It is generally possible to open the same local mail folder simultaneously, via multiple mail::account objects, as long as only one pending request is issued at a time. Concurrent access to local maildirs generally works well, however simultaneous access to the same mbox folder may be rather slow, due to the overhead of locking and rescanning of the folder by each mail::account object.

Any previously-opened folder is closed before the an attempt to open this folder is made. If the new folder cannot be opened, the previous folder is still considered closed.

## RETURN CODES AND CALLBACKS

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::getTopLevelFolders(3x), mail::ACCOUNT::readFolderInfo(3x).

Prev | Up | Next
mail::ACCOUNT::moveMessagesTo | Home | ToC | mail::ACCOUNT::readFolderInfo