{"id":16219,"library":"simplesmtp","title":"simplesmtp: Simple SMTP Server and Client Module","description":"simplesmtp is a Node.js module designed for creating custom SMTP servers and clients, primarily targeting older Node.js environments (v0.6 to v0.8+). The package, currently at version 0.3.35, is explicitly deprecated and no longer maintained. It was developed without Node.js v0.10 streams, indicating significant compatibility challenges with Node.js v0.12 and newer versions. While it offers basic SMTP functionality suitable for integration testing, it lacks active development, security updates, and modern features. Users are strongly advised to migrate to modern alternatives like `smtp-server` for server implementations, `smtp-connection` for client-side operations, or `Haraka` for full-featured SMTP applications, which offer better performance, security, and compatibility with current Node.js releases. There is no ongoing release cadence.","status":"abandoned","version":"0.3.35","language":"javascript","source_language":"en","source_url":"http://github.com/andris9/simplesmtp","tags":["javascript","servers","text-based","smtp","email","mail","e-mail"],"install":[{"cmd":"npm install simplesmtp","lang":"bash","label":"npm"},{"cmd":"yarn add simplesmtp","lang":"bash","label":"yarn"},{"cmd":"pnpm add simplesmtp","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This module is CommonJS-only, designed for older Node.js environments. ES Modules (ESM) import syntax will not work.","wrong":"import simplesmtp from 'simplesmtp';","symbol":"simplesmtp","correct":"const simplesmtp = require('simplesmtp');"},{"note":"The `createSimpleServer` function is a property of the main `simplesmtp` module export, not a named export. Ensure you import the entire module first.","wrong":"import { createSimpleServer } from 'simplesmtp';","symbol":"createSimpleServer","correct":"const simplesmtp = require('simplesmtp');\nsimplesmtp.createSimpleServer(/* options */, requestListener);"},{"note":"While `require('simplesmtp').createServer()` might work, the idiomatic pattern for this library is to import the main module first, then access its methods for clarity and consistency.","wrong":"const server = require('simplesmtp').createServer();","symbol":"createServer","correct":"const simplesmtp = require('simplesmtp');\nconst server = simplesmtp.createServer(/* options */);"}],"quickstart":{"code":"const simplesmtp = require('simplesmtp');\n\nconst PORT = process.env.SMTP_PORT || 2525;\n\nsimplesmtp.createSimpleServer({\n  SMTPBanner: \"My Test SMTP Server\",\n  debug: true\n}, function(req) {\n  console.log(`[simplesmtp] New message from: ${req.from}`);\n  console.log(`[simplesmtp] To: ${req.to.join(', ')}`);\n  console.log(`[simplesmtp] Host: ${req.host}`);\n  console.log(`[simplesmtp] Client IP: ${req.remoteAddress}`);\n\n  // Pipe the incoming email data to stdout\n  console.log('\\n--- Email Body Start ---');\n  req.pipe(process.stdout);\n  req.on('end', () => {\n    console.log('\\n--- Email Body End ---');\n    // Accept the message after processing\n    req.accept();\n    console.log(`[simplesmtp] Message accepted from ${req.from}`);\n  });\n}).listen(PORT, function() {\n  console.log(`[simplesmtp] Simple SMTP server listening on port ${PORT}`);\n  console.log('Send an email to this server (e.g., via telnet: `telnet localhost 2525`, then SMTP commands like `MAIL FROM:<test@example.com>`, `RCPT TO:<recipient@example.com>`, `DATA`, `Subject: Test\\n\\nHello world!\\n.`)');\n});","lang":"javascript","description":"This quickstart sets up a basic `simplesmtp` server that listens on port 2525 (or `SMTP_PORT` if set), logs incoming email metadata, pipes the email body to standard output, and then accepts the message."},"warnings":[{"fix":"Migrate to `smtp-server` for SMTP server functionality or `smtp-connection` for SMTP client functionality. For full-featured servers, consider `Haraka`.","message":"This module is officially deprecated and no longer maintained. It does not use Node.js v0.10 streams and is explicitly stated to have a 'rocky future' with Node.js v0.12+. Using it with modern Node.js versions (v0.12+) will likely result in runtime errors related to stream APIs or other breaking changes.","severity":"breaking","affected_versions":">=0.3.x"},{"fix":"Immediately replace `simplesmtp` with actively maintained and secure alternatives (`smtp-server`, `smtp-connection`, `Haraka`). Regularly review security advisories for your chosen alternatives.","message":"Security vulnerabilities in this abandoned package will not be patched. Using `simplesmtp` in production environments or with sensitive data is highly discouraged due to the lack of security updates and potential for undiscovered exploits.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"For Node.js v0.6, explicitly install `simplesmtp@0.2.7`. For Node.js v0.8+, use `simplesmtp@0.3.x`, but be aware of its overall deprecation.","message":"Compatibility with Node.js v0.6 requires using `simplesmtp` v0.2.7. Later versions (v0.3.x) are designed for Node.js v0.8+.","severity":"gotcha","affected_versions":"<0.3.0"},{"fix":"Always use `const simplesmtp = require('simplesmtp');` for importing this module.","message":"The module is CommonJS-only. Attempting to use ESM `import` statements will result in a runtime error.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"This package is fundamentally incompatible with modern Node.js. Replace `simplesmtp` with a contemporary, actively maintained SMTP library like `smtp-server`.","cause":"This error likely occurs when running `simplesmtp` on Node.js versions v0.12 or newer. The module was written for older Node.js streams and is incompatible with modern stream APIs.","error":"TypeError: req.pipe is not a function"},{"fix":"This package is strictly CommonJS. If your project is an ESM project, you will need to wrap the `require` call or, preferably, switch to a modern, ESM-compatible SMTP library. For this specific package, ensure your environment is CommonJS compatible (e.g., remove `\"type\": \"module\"` from `package.json` if possible, or use a CommonJS entry point).","cause":"You are attempting to use the CommonJS `require()` function in an ES Module context, or trying to `import` a CommonJS module in a way that is not directly supported by Node.js, possibly due to `type: module` in `package.json`.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... is not supported."},{"fix":"Run `npm install simplesmtp` to add the package to your project dependencies. Verify the spelling of the module name in your `require()` statement.","cause":"The `simplesmtp` package has not been installed, or there is a typo in the `require()` path.","error":"Cannot find module 'simplesmtp'"}],"ecosystem":"npm"}