Node-pop3 is a JavaScript client library for the Post Office Protocol version 3 (POP3), designed for use in Node.js environments. It provides functionalities to connect to POP3 servers, authenticate users, list messages, retrieve mail content, and manage mailboxes. The library supports both Promise-based asynchronous operations for cleaner code and Node.js Streams for efficient handling of potentially large mail bodies. Version `0.11.0` is the current stable release, requiring Node.js `^20.11.0 || >= 22.0.0`. It ships with TypeScript type definitions, enhancing development experience for TypeScript users. Key differentiators include its explicit support for modern JavaScript constructs like Promises and Streams, along with a simple command-line interface (CLI) for testing. While similar libraries exist, node-pop3 aims for a direct API mirroring the POP3 protocol, rather than a high-level abstraction.
npm install node-pop3Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a POP3 server, authenticate, retrieve mailbox statistics, list message UIDs, and fetch the content of the first message, finally disconnecting. It uses environment variables for credentials and showcases error handling.
Ensure commands like `USER`, `PASS`, `STAT`, `RETR`, `QUIT` are executed in the correct POP3 protocol order. Higher-level methods like `RETR` or `UIDL` handle the `USER`/`PASS` authentication internally after `connect`.
Inspect `error.eventName` and `error.command` properties on caught exceptions for more granular error handling and debugging specific network or command-related issues.
Refer to the official Node.js `tls.connect` documentation for your specific Node.js version when configuring `tlsOptions` to ensure compatibility and correct behavior.
Double-check `user` and `password` credentials. Verify that POP3 access is enabled for the email account on the mail server. Ensure `tls` option is correctly set if the server requires an SSL/TLS connection.
Check network connectivity and firewall rules. Ensure the POP3 server is accessible and not under heavy load. Implement retry logic with exponential backoff for transient network issues.
Verify `host` and `port` are correct. Confirm the POP3 server is running and accessible from the client's network. Check firewall settings on both client and server sides.
Ensure `await pop3.connect()` completes successfully before attempting to send any commands. Do not send commands after `await pop3.QUIT()`.
No dependency data recorded yet.