node.jstypescriptimapeconnrefused

Node.js IMAP ECONNREFUSED


Why can't I event change the port number? I have already close all the firewall

CODE:

var imapConfig = new Imap({
    user: "xxxxxxxxxxxxxxxx",
    password: "xxxxxxxxx",
    server: "imap.gmail.com",
    port: 993,
    tls: true,
    debug: console.log,
});

clog(levels.NORMAL, "Email connection");

const imap = new Imap(imapConfig);

RESULT:

[connection] Error: Error: connect ECONNREFUSED 127.0.0.1:143
20231207101555.140000N Error: connect ECONNREFUSED 127.0.0.1:143
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 143,
source: 'socket'
}
[connection] Closed

can someone tell or help me to solve this problem? ty


Solution

  • try

    var imapConfig = {
        user: "xxxxxxxxxxxxxxxx",
        password: "xxxxxxxxx",
        server: "imap.gmail.com",
        port: 993,
        tls: true,
        debug: console.log,
    };
    
    clog(levels.NORMAL, "Email connection");
    
    const imap = new Imap(imapConfig);