mail::ACCOUNT::checkNewMail.3x man page
mail::ACCOUNT::checkNewMail — Check for new mail in the current folder
#include <libmail/sync.H> mail::ACCOUNT *mail;
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.
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.
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.