imap.disconnect(connection) Last updated: 20. Oct 2024

API only function

Disconnects an existing imap session.

Parameters

Name Type Description
connection object The imap session object to disconnect

Returns

A boolean indicating whether the disconnection was successful.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let i = imap.connect(config);
// Perform operations with the imap session
// ...
// Disconnect when finished
let disconnected = imap.disconnect(i);
if (disconnected) {
    return "Successfully disconnected from IMAP server";
} else {
    return "Failed to disconnect from IMAP server";
}