imap.connect(config) Last updated: 25. Jan 2024

API only function

Creates a new imap session and connects to server.

Parameters

Name Type Description
config object Uses same setup as POP3. But also with the property

"method" - with one of the following values: Login, CRAMMD5 or SaslOAuth

Returns

An object with the imap session.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let i = imap.connect(config);
let count = imap.getCount(i);
if (count > 0) {
    var msg = imap.getMessage(i, 0);
    imap.delete(i, msg);
    return msg;
}
return "No emails in inbox";