Installation
Get started with smtp-server by installing it in your Node.js project. The library is available on npm and can be installed using your preferred package manager.Prerequisites
If you need to upgrade Node.js, visit nodejs.org to download the latest LTS version.Package Manager Installation
Choose your preferred package manager and run the corresponding command:Verify Installation
After installation, verify that smtp-server is installed correctly by checking yourpackage.json:
package.json
test.js
Dependencies
smtp-server automatically installs the following dependencies:- nodemailer (7.0.13+) - Shared utilities and logging
- ipv6-normalize (1.0.1+) - IPv6 address normalization
- punycode.js (2.3.1+) - Unicode domain name handling
These dependencies are managed automatically - you don’t need to install them separately.
TypeScript Support
While smtp-server is written in JavaScript, you can use it in TypeScript projects. For type definitions, you may need to create your own declarations or use the library withany types:
server.ts
Development Installation
If you want to contribute to smtp-server or run the examples from the repository, clone the source code:Next Steps
Quick Start
Build your first SMTP server in minutes
API Reference
Explore the complete API documentation
Troubleshooting
Node.js Version Error
If you see an error about Node.js version compatibility:Installation Fails
If installation fails, try:-
Clear your package manager cache:
-
Delete
node_modulesand lock files, then reinstall:
Permission Errors
If you encounter permission errors during installation, avoid usingsudo. Instead, configure npm to use a different directory:
export line to your ~/.bashrc or ~/.zshrc to make it permanent.