imap.getCount(session, [pollDuration]) Last updated: 14. Oct 2024
API only function
Retrieves the current number of messages in the inbox.
Parameters
Name | Type | Description |
---|---|---|
session | object | IMAP session object obtained from imap.connect(). |
pollDuration (optional) | int | Duration in seconds to repeatedly check the inbox for new messages using the same TCP connection. Will check every second within this specified period. If not set, the default value is 0 (no polling). |
Returns
Total number of emails in the inbox.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.let session = imap.connect(config);
let messageCount = imap.getCount(session);
write(messageCount);