ditesh / node-poplib

POP3 client library for Node.js
MIT License
128 stars 44 forks source link

quick question on login callback #10

Closed user1020 closed 10 years ago

user1020 commented 10 years ago

Thanks Ditesh for creating this module.

In your example, I saw client.login(username, password); wonder if there is a callback that fires when login is successful?

thanks in advance

ditesh commented 10 years ago

You should get a login event on successful login, e.g.:

client.on("login", function(status, rawdata) {

    if (status) {

        console.log("LOGIN/PASS success");
        client.list();

    } else {

        console.log("LOGIN/PASS failed");
        client.quit();

    }
});
user1020 commented 10 years ago

Thanks Ditesh. I should have read the document a little more carefully.