Is there a way to add custom flags in node-imap?? I wanted to add flag like 'Starred' or 'Important' but not successful yet. I've read in the docs something about permFlags and adding custom flags provided by server but not sure if they think server as email provider or our backend as server. I'm successfully adding system flags but not custom ones. I'm guessing they need to be added to permFlags previously, if so how? This is code I use for adding/deleting system flags:
imap.once('ready', () => {
imap.openBox('inbox', false, (err, box) => {
if (err) throw err;
let ids = JSON.parse("[" + id + "]");
if (data.flag) { //if true add flag
imap.seq.addFlags(ids, data.name, (err) => {
if (err) throw err;
})
} else { //if false delete flag
imap.seq.delFlags(ids, data.name, (err) => {
if (err) throw err;
})
}
imap.closeBox(function (err) {
if (err) throw err;
imap.end();
});
})
})