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

## Name

mail::ACCOUNT::checkNewMail — Check for new mail in the current folder

## Synopsis

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

`bool ok=mail->checkNewMail(` | `void)`; |

## USAGE

This method returns an indication whether the current open folder was changed. The name is slightly misleading; `mail::ACCOUNT::checkNewMail` also indicates whether messages have been removed from the folder, and whether the status of any message has changed.

Most mail servers allow multiple applications to use the same folder. Therefore, changes to the folder's contents may occur at any time. This method should be used prior to starting any operation that intends to use an existing message. If `mail::ACCOUNT::checkNewMail` returns true, the application should then use mail::ACCOUNT::getFolderIndexSize(3x) and mail::ACCOUNT::getFolderIndexInfo(3x) to read the current folder index, and compare the current list of message UIDs against the previously obtained list in order to determine which messages were added or removed from the folder.

## Return Codes

This function returns `true` if there were any changes to the folder's contents after the folder was opened, or since the previous call to `mail::ACCOUNT::checkNewMail`.

### Note

Calling mail::ACCOUNT::updateFolderIndexInfo(3x), mail::ACCOUNT::updateFolderIndexFlags(3x), and all other methods that modify the contents of the current folder will usually result in the next call to `mail::ACCOUNT::checkNewMail` returning `true`.

## SEE ALSO

mail::ACCOUNT::saveFolderIndexInfo(3x), mail::ACCOUNT::getFolderIndexInfo(3x).

Prev | Up | Next
mail::ACCOUNT::addMessage | Home | ToC | mail::ACCOUNT::copyMessagesTo