imap.delete(session, message) Last updated: 21. Feb 2024

API only function

Deletes a specific message from the inbox.

Parameters

Name Type Description
session object Imap session from imap.connect()
message object Message object of message to delete.
Use the "GetMessage" method to retreive this.

Returns

Null

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 { "deleted" : msg };
}
return "No messages in inbox";