Function API only Updated 22 Oct 2026
imap.disconnect(connection)
Disconnects an existing imap session.
Parameters
connectionobjectrequiredThe imap session object to disconnect
Returns
A boolean indicating whether the disconnection was successful.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
// Configure connection (see imap.connect example)
let config = {
"hostname" : "serverhost",
"port" : 993,
"useSsl" : true,
"username" : "login",
"password" : "pass",
"method" : "Login"
};
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";
}