firstly i try get imap by ,
`let imap = new Imap({
user: username,
password: appPassword,
host: host,
//authentication: appPassword,
port: 993,
autotls: "always",
tls: true,
ssl: true,
tlsOptions: { rejectUnauthorized: false, servername: host },
connTimeout: 30000,
authTimeout: 30000,
});`
then i pass the imap and connect using
`imap.connect();
imap.once("ready", () => {
resolve(imap);
});
imap.once("error", async (error) => {
if(error.message.toLowerCase() === "this socket has been ended by the other party") {
imap.end();
}
});`
the connection is made successfully,
after this i get the valid uids to delete , valid trash label.
then i open the correct mailbox to move from , then i use
`imap.move(uids, trashFolderName, async function (err) {
if (err) {
reject(err);
return;
}
}`
here the problem starts – the uids get moved to trash but i get error “this socket has been ended by the other party” and the code after imap.move doesnot gets executed.
i dont know how to solve it .
if you already experienced in this , kindly help.