UNPKG

smtp-server

Version:

Create custom SMTP servers on the fly

463 lines (255 loc) 21.4 kB
# Changelog ## [3.19.2](https://github.com/nodemailer/smtp-server/compare/v3.19.1...v3.19.2) (2026-07-05) ### Bug Fixes * update dependencies (nodemailer 9.0.3) ([0eaaeb0](https://github.com/nodemailer/smtp-server/commit/0eaaeb0129531c3d38d2407a2f2154e1f2e2d334)) ## [3.19.1](https://github.com/nodemailer/smtp-server/compare/v3.19.0...v3.19.1) (2026-06-19) ### Bug Fixes * bump nodemailer to 9.0.1 ([e3e6a6b](https://github.com/nodemailer/smtp-server/commit/e3e6a6bb51f72b9e2ed04ece658d4f7ab3ff741e)) ## [3.19.0](https://github.com/nodemailer/smtp-server/compare/v3.18.5...v3.19.0) (2026-06-15) ### Features * add lenientAddressParsing option to relax strict address validation ([2237bb4](https://github.com/nodemailer/smtp-server/commit/2237bb49d0b73bc03c11313c0bff96f438b73049)), closes [#259](https://github.com/nodemailer/smtp-server/issues/259) * update stream.sizeExceeded and byteLength in real time ([9051734](https://github.com/nodemailer/smtp-server/commit/905173497a797e2d84bcc1805301ac82dc0c727b)) ### Bug Fixes * cap PROXY header length to prevent unbounded buffering ([38a3190](https://github.com/nodemailer/smtp-server/commit/38a31900716023e4d509bab8db50f656ed1a2459)) * expose SASL PLAIN authzid and reject control characters in usernames ([4107568](https://github.com/nodemailer/smtp-server/commit/4107568efbbebb3a53b913712cdc771aa3f3967f)), closes [#261](https://github.com/nodemailer/smtp-server/issues/261) * handle half-open socket close while reading PROXY header ([cdaefd8](https://github.com/nodemailer/smtp-server/commit/cdaefd80cb49c89fb0f42729ceba988c387c71e0)) * prevent uncaughtException when client disconnects before PROXY header ([e240a50](https://github.com/nodemailer/smtp-server/commit/e240a5090e0fc1b19dc2ce12d7f62cd993cb4cdf)) * reject STARTTLS parameters and control characters in envelope input ([db1f3d4](https://github.com/nodemailer/smtp-server/commit/db1f3d41a26b92f956565ee993d5df6ca84dd84e)), closes [#260](https://github.com/nodemailer/smtp-server/issues/260) * use crypto.randomBytes for CRAM-MD5 challenge ([4dbc916](https://github.com/nodemailer/smtp-server/commit/4dbc91696b7921b8d1e4b3998167c11314b9b98a)) ## [3.18.5](https://github.com/nodemailer/smtp-server/compare/v3.18.4...v3.18.5) (2026-05-29) ### Bug Fixes * bumped deps ([1b1ea07](https://github.com/nodemailer/smtp-server/commit/1b1ea076754bb6d4a59ca92982d251424828445f)) ## [3.18.4](https://github.com/nodemailer/smtp-server/compare/v3.18.3...v3.18.4) (2026-04-08) ### Bug Fixes * Bumped deps ([cd06abe](https://github.com/nodemailer/smtp-server/commit/cd06abeba0a62e5a82e9aa7a08c5e2058d96203a)) ## [3.18.3](https://github.com/nodemailer/smtp-server/compare/v3.18.2...v3.18.3) (2026-03-25) ### Bug Fixes * limit command line length to prevent memory exhaustion ([592c566](https://github.com/nodemailer/smtp-server/commit/592c5666fa0c76d1d04c1a32abad0ef806fbfe97)) ## [3.18.2](https://github.com/nodemailer/smtp-server/compare/v3.18.1...v3.18.2) (2026-03-23) ### Bug Fixes * Bumped deps ([e3c7088](https://github.com/nodemailer/smtp-server/commit/e3c70880fd831d4b93db58cab84a59688bf9fcd0)) ## [3.18.1](https://github.com/nodemailer/smtp-server/compare/v3.18.0...v3.18.1) (2026-01-28) ### Bug Fixes * Bumpe deps ([0ddf650](https://github.com/nodemailer/smtp-server/commit/0ddf6500d78a3aa3ebbc754efbff88fbaadcb15e)) ## [3.18.0](https://github.com/nodemailer/smtp-server/compare/v3.17.1...v3.18.0) (2025-12-22) ### Features * added support for `allowIPLiteralAddresses` (closes [#244](https://github.com/nodemailer/smtp-server/issues/244)) ([d7e4fa7](https://github.com/nodemailer/smtp-server/commit/d7e4fa7e3597a0416a11528b4b9ac9bd11373306)) ### Bug Fixes * fix literal format checking (closes [#244](https://github.com/nodemailer/smtp-server/issues/244)) ([8b7d426](https://github.com/nodemailer/smtp-server/commit/8b7d4262c34b0923cd81c2e58137facd8b11ae5a)) * fix literal format checking and remove configurable option ([2361c04](https://github.com/nodemailer/smtp-server/commit/2361c04402e75cd8a5c1c2eacd5709b39cdffffc)) ## [3.17.1](https://github.com/nodemailer/smtp-server/compare/v3.17.0...v3.17.1) (2025-12-12) ### Bug Fixes * log tls protocol version and other metainfo on tls error ([#242](https://github.com/nodemailer/smtp-server/issues/242)) ([26a2e3d](https://github.com/nodemailer/smtp-server/commit/26a2e3d7915cf45912c27648b5d130b2e707654c)) ## [3.17.0](https://github.com/nodemailer/smtp-server/compare/v3.16.1...v3.17.0) (2025-12-11) ### Features * add ability to customize auth required error message ([e0f3e64](https://github.com/nodemailer/smtp-server/commit/e0f3e64aa55246aa0ee42d9a6b5303fe2a802226)) * add configurable heloResponse option for HELO/EHLO greeting ([7c8279f](https://github.com/nodemailer/smtp-server/commit/7c8279f4c2ea3d19d27efaa54d8378f12de3f986)) * added DSN capability to feature list (disabled by default) ([#230](https://github.com/nodemailer/smtp-server/issues/230)) ([bb17377](https://github.com/nodemailer/smtp-server/commit/bb17377f47830b1d8ebb414c7c7420b1317b5e0c)) * added support for ENHANCEDSTATUSCODES and DSN (closes [#224](https://github.com/nodemailer/smtp-server/issues/224)) ([#225](https://github.com/nodemailer/smtp-server/issues/225)) ([ad545ef](https://github.com/nodemailer/smtp-server/commit/ad545ef0904b388aa3b98d2156eac5a8e7bfeba0)) * added support for REQUIRETLS and other body params ([71ce3aa](https://github.com/nodemailer/smtp-server/commit/71ce3aae1d0b41709913cb1fa1a89d65f949f92e)) ### Bug Fixes * 193 ([657ac6e](https://github.com/nodemailer/smtp-server/commit/657ac6e9964e5c6613be144450a8a0f61862888c)) * added resolver option, if server closing do not permit commands (fixes [#177](https://github.com/nodemailer/smtp-server/issues/177), fixes [#181](https://github.com/nodemailer/smtp-server/issues/181)) ([#222](https://github.com/nodemailer/smtp-server/issues/222)) ([e79cac9](https://github.com/nodemailer/smtp-server/commit/e79cac9369dbca97cc47a24371151886ea60695e)) * bug with proxy ([#218](https://github.com/nodemailer/smtp-server/issues/218)) ([9515e38](https://github.com/nodemailer/smtp-server/commit/9515e38ae0a2c03a3bbd81e3db9991cb908110d7)) * bumped deps ([c499a3c](https://github.com/nodemailer/smtp-server/commit/c499a3c18e6df6563ac02593f8b053073de5fc84)) * Bumped deps ([ce34da4](https://github.com/nodemailer/smtp-server/commit/ce34da43a76675689bd7a88c75ba6977d2984e21)) * **deploy:** added autorelease ([0dbc8e1](https://github.com/nodemailer/smtp-server/commit/0dbc8e11412982395283b354c90e9ab443a7232a)) * **deps:** Bumped deps ([e096b12](https://github.com/nodemailer/smtp-server/commit/e096b129af13a2c2d4893a8690ba06fe00fe36d2)) * **deps:** Bumped deps ([0a2d601](https://github.com/nodemailer/smtp-server/commit/0a2d6015b69a538b2b615d172b0c5903529370f6)) * **deps:** use punycode module ([438c617](https://github.com/nodemailer/smtp-server/commit/438c617d6ff46121fe76b90da2f1f34220ba7ae4)) * relax email validation to accept Gmail forwarding addresses ([9e83b07](https://github.com/nodemailer/smtp-server/commit/9e83b07be336eec812bd1c6f5f1d4c4389dcb579)) * relax email validation to accept Gmail forwarding addresses ([b5ea6d9](https://github.com/nodemailer/smtp-server/commit/b5ea6d91b1f795ad4ecce47623969ae83e064a63)) * **release:** fixed Git URL on package.json ([5876626](https://github.com/nodemailer/smtp-server/commit/5876626aed6239ff0de4999fdf583febdda38744)) * Replaced punycode with punycode.js ([4ccbcf2](https://github.com/nodemailer/smtp-server/commit/4ccbcf2f7d0daee0554c416be03d0eda7e2999f5)) * strengthen email validation in _parseAddressCommand ([9aced8d](https://github.com/nodemailer/smtp-server/commit/9aced8daa1afdaf40a987ba3e560a7963b910352)) * unref timers to allow graceful process exit ([e2542d2](https://github.com/nodemailer/smtp-server/commit/e2542d292d0ebd6ecae95c6201ab4c6aab496310)) * update dependencies ([7f22889](https://github.com/nodemailer/smtp-server/commit/7f228899744cb9da04e2bff765dab46126b37b09)) * **XFORWARD:** Fixed client hostname processing. Fixes [#147](https://github.com/nodemailer/smtp-server/issues/147) ([d518417](https://github.com/nodemailer/smtp-server/commit/d518417d0b9274cc45a5fde597142f79867d3eeb)) ## [3.16.1](https://github.com/nodemailer/smtp-server/compare/smtp-server-v3.16.0...smtp-server-v3.16.1) (2025-11-05) ### Bug Fixes * relax email validation to accept Gmail forwarding addresses ([b5ea6d9](https://github.com/nodemailer/smtp-server/commit/b5ea6d91b1f795ad4ecce47623969ae83e064a63)) ## [3.16.0](https://github.com/nodemailer/smtp-server/compare/smtp-server-v3.15.0...smtp-server-v3.16.0) (2025-10-29) ### Features * add ability to customize auth required error message ([e0f3e64](https://github.com/nodemailer/smtp-server/commit/e0f3e64aa55246aa0ee42d9a6b5303fe2a802226)) * add configurable heloResponse option for HELO/EHLO greeting ([7c8279f](https://github.com/nodemailer/smtp-server/commit/7c8279f4c2ea3d19d27efaa54d8378f12de3f986)) * added DSN capability to feature list (disabled by default) ([#230](https://github.com/nodemailer/smtp-server/issues/230)) ([bb17377](https://github.com/nodemailer/smtp-server/commit/bb17377f47830b1d8ebb414c7c7420b1317b5e0c)) * added support for ENHANCEDSTATUSCODES and DSN (closes [#224](https://github.com/nodemailer/smtp-server/issues/224)) ([#225](https://github.com/nodemailer/smtp-server/issues/225)) ([ad545ef](https://github.com/nodemailer/smtp-server/commit/ad545ef0904b388aa3b98d2156eac5a8e7bfeba0)) * added support for REQUIRETLS and other body params ([71ce3aa](https://github.com/nodemailer/smtp-server/commit/71ce3aae1d0b41709913cb1fa1a89d65f949f92e)) ### Bug Fixes * 193 ([657ac6e](https://github.com/nodemailer/smtp-server/commit/657ac6e9964e5c6613be144450a8a0f61862888c)) * added resolver option, if server closing do not permit commands (fixes [#177](https://github.com/nodemailer/smtp-server/issues/177), fixes [#181](https://github.com/nodemailer/smtp-server/issues/181)) ([#222](https://github.com/nodemailer/smtp-server/issues/222)) ([e79cac9](https://github.com/nodemailer/smtp-server/commit/e79cac9369dbca97cc47a24371151886ea60695e)) * bug with proxy ([#218](https://github.com/nodemailer/smtp-server/issues/218)) ([9515e38](https://github.com/nodemailer/smtp-server/commit/9515e38ae0a2c03a3bbd81e3db9991cb908110d7)) * bumped deps ([c499a3c](https://github.com/nodemailer/smtp-server/commit/c499a3c18e6df6563ac02593f8b053073de5fc84)) * Bumped deps ([ce34da4](https://github.com/nodemailer/smtp-server/commit/ce34da43a76675689bd7a88c75ba6977d2984e21)) * **deploy:** added autorelease ([0dbc8e1](https://github.com/nodemailer/smtp-server/commit/0dbc8e11412982395283b354c90e9ab443a7232a)) * **deps:** Bumped deps ([e096b12](https://github.com/nodemailer/smtp-server/commit/e096b129af13a2c2d4893a8690ba06fe00fe36d2)) * **deps:** Bumped deps ([0a2d601](https://github.com/nodemailer/smtp-server/commit/0a2d6015b69a538b2b615d172b0c5903529370f6)) * **deps:** use punycode module ([438c617](https://github.com/nodemailer/smtp-server/commit/438c617d6ff46121fe76b90da2f1f34220ba7ae4)) * **release:** fixed Git URL on package.json ([5876626](https://github.com/nodemailer/smtp-server/commit/5876626aed6239ff0de4999fdf583febdda38744)) * Replaced punycode with punycode.js ([4ccbcf2](https://github.com/nodemailer/smtp-server/commit/4ccbcf2f7d0daee0554c416be03d0eda7e2999f5)) * strengthen email validation in _parseAddressCommand ([9aced8d](https://github.com/nodemailer/smtp-server/commit/9aced8daa1afdaf40a987ba3e560a7963b910352)) * unref timers to allow graceful process exit ([e2542d2](https://github.com/nodemailer/smtp-server/commit/e2542d292d0ebd6ecae95c6201ab4c6aab496310)) * **XFORWARD:** Fixed client hostname processing. Fixes [#147](https://github.com/nodemailer/smtp-server/issues/147) ([d518417](https://github.com/nodemailer/smtp-server/commit/d518417d0b9274cc45a5fde597142f79867d3eeb)) ## [3.15.0](https://github.com/nodemailer/smtp-server/compare/v3.14.0...v3.15.0) (2025-10-09) ### Features * added DSN capability to feature list (disabled by default) ([#230](https://github.com/nodemailer/smtp-server/issues/230)) ([bb17377](https://github.com/nodemailer/smtp-server/commit/bb17377f47830b1d8ebb414c7c7420b1317b5e0c)) ### Bug Fixes * bumped deps ([c499a3c](https://github.com/nodemailer/smtp-server/commit/c499a3c18e6df6563ac02593f8b053073de5fc84)) ## [3.14.0](https://github.com/nodemailer/smtp-server/compare/v3.13.8...v3.14.0) (2025-06-27) ### Features * added support for ENHANCEDSTATUSCODES and DSN (closes [#224](https://github.com/nodemailer/smtp-server/issues/224)) ([#225](https://github.com/nodemailer/smtp-server/issues/225)) ([ad545ef](https://github.com/nodemailer/smtp-server/commit/ad545ef0904b388aa3b98d2156eac5a8e7bfeba0)) ## [3.13.8](https://github.com/nodemailer/smtp-server/compare/v3.13.7...v3.13.8) (2025-06-04) ### Bug Fixes * added resolver option, if server closing do not permit commands (fixes [#177](https://github.com/nodemailer/smtp-server/issues/177), fixes [#181](https://github.com/nodemailer/smtp-server/issues/181)) ([#222](https://github.com/nodemailer/smtp-server/issues/222)) ([e79cac9](https://github.com/nodemailer/smtp-server/commit/e79cac9369dbca97cc47a24371151886ea60695e)) ## [3.13.7](https://github.com/nodemailer/smtp-server/compare/v3.13.6...v3.13.7) (2025-05-20) ### Bug Fixes * bug with proxy ([#218](https://github.com/nodemailer/smtp-server/issues/218)) ([9515e38](https://github.com/nodemailer/smtp-server/commit/9515e38ae0a2c03a3bbd81e3db9991cb908110d7)) * Bumped deps ([ce34da4](https://github.com/nodemailer/smtp-server/commit/ce34da43a76675689bd7a88c75ba6977d2984e21)) ## [3.13.6](https://github.com/nodemailer/smtp-server/compare/v3.13.5...v3.13.6) (2024-10-21) ### Bug Fixes * **XFORWARD:** Fixed client hostname processing. Fixes [#147](https://github.com/nodemailer/smtp-server/issues/147) ([d518417](https://github.com/nodemailer/smtp-server/commit/d518417d0b9274cc45a5fde597142f79867d3eeb)) ## [3.13.5](https://github.com/nodemailer/smtp-server/compare/v3.13.4...v3.13.5) (2024-09-08) ### Bug Fixes * Replaced punycode with punycode.js ([4ccbcf2](https://github.com/nodemailer/smtp-server/commit/4ccbcf2f7d0daee0554c416be03d0eda7e2999f5)) ## [3.13.4](https://github.com/nodemailer/smtp-server/compare/v3.13.3...v3.13.4) (2024-04-12) ### Bug Fixes * **deps:** Bumped deps ([e096b12](https://github.com/nodemailer/smtp-server/commit/e096b129af13a2c2d4893a8690ba06fe00fe36d2)) ## [3.13.3](https://github.com/nodemailer/smtp-server/compare/v3.13.2...v3.13.3) (2024-02-29) ### Bug Fixes * **deps:** Bumped deps ([0a2d601](https://github.com/nodemailer/smtp-server/commit/0a2d6015b69a538b2b615d172b0c5903529370f6)) ## [3.13.2](https://github.com/nodemailer/smtp-server/compare/v3.13.1...v3.13.2) (2024-02-02) ### Bug Fixes * **release:** fixed Git URL on package.json ([5876626](https://github.com/nodemailer/smtp-server/commit/5876626aed6239ff0de4999fdf583febdda38744)) ## [3.13.1](https://github.com/nodemailer/smtp-server/compare/v3.13.0...v3.13.1) (2024-02-02) ### Bug Fixes * **deploy:** added autorelease ([0dbc8e1](https://github.com/nodemailer/smtp-server/commit/0dbc8e11412982395283b354c90e9ab443a7232a)) * **deps:** use punycode module ([438c617](https://github.com/nodemailer/smtp-server/commit/438c617d6ff46121fe76b90da2f1f34220ba7ae4)) ## v3.13.0 2023-08-15 - new event handler `onSecure` - specified license identifier in package.json (from `MIT` to `MIT-0`) ## v3.12.0 2023-05-24 - new option `authRequiredMessage` - Bumped deps ## v3.11.0 2022-04-28 - Added github workflow for tests - Removed Travis - Fixed compatibility for Node v18 - Bumped deps ## v3.10.0 2022-02-23 - Add missing space suffix to an empty 334 response - Bumped dependencies ## v3.9.0 2021-06-01 - Bumped dependencies - Added extra log entries for 'close' events ## v3.8.0 2020-11-13 - Bump dependencies to latest - Access to challenge and challengeResponse (CRAM-MD5) ## v3.7.0 2020-06-25 - Bump dependencies to latest ## v3.6.0 2020-03-15 - Add remote address to any errors - Bump dependencies to latest ## v3.5.0 2019-01-04 - Fix reverse resolving invalid hostname error where greeting was sent twice - Bump Nodemailer version to v5.0.0 ## v3.4.5 2018-05-25 - Expose connection id in 'connect' event ## v3.4.4 2018-05-04 - Enclose punycode calls in try..catch ## v3.4.2 2018-03-16 - handle missing address in listener handler ## v3.4.0 2017-12-01 - Added new property `secured` to indicate an TLS server where TLS is handled upstream - Allow handling TLS after PROXY header ## v3.3.1 2017-11-28 - Do not choke on overly long reverse DNS call ## v3.3.0 2017-10-05 - Added new method updateSecureContext({key, cert}) to update TLS options live ## v3.2.0 2017-10-01 - Return net.listen() value ## v3.1.0 2017-08-16 - Added new server option `needsUpgrade` to upgrade sockets to TLS immediately after connection is established. Works with secure: true ## v3.0.0 2017-04-06 - Reverted license back to MIT ## v2.0.3 2017-02-17 - Expose `secure` state in session ## v2.0.2 2017-02-17 - Fixad a bug where `server.onConnect(err)` did not close the connection ## v2.0.1 2017-02-04 - Fixad a bug where `server.on('connect', data)` had missing `data` ## v2.0.0 2017-02-04 - Changed license from MIT to EUPL-v1.1 - Rewrite to use ES6, this means at least Node.js v6.0.0 is required to use smtp-server ## v1.16.1 2016-10-17 - Allowed rewriting `connect` method ## v1.16.0 2016-10-17 - Added new method `connect` to pass already established sockets to the server ## v1.15.0 2016-09-23 - Added new connection property `remotePort` - Emit 'connect' event when all handshakes (including PROXY) have been completed ## v1.14.2 2016-09-02 - Fix issue with invalidly resolved IPv4 addresses on IPv6 interface ## v1.14.1 2016-08-16 - Ignore connection errors outside transaction ## v1.14.0 2016-08-09 - Expose connection TLS cipher in the `tlsOptions` property ## v1.13.1 2016-07-29 - Fixed remoteHostname resolving bug ## v1.13.0 2016-07-29 - Added new option `disableReverseLookup` to skip reverse resolving client hostname on connection ## v1.12.0 2016-07-25 - Added new property for session: `session.transmissionType` that identifies the current transmission (SMTP, ESMTP, ESMTPA etc.) ## v1.11.2 2016-07-15 - Do not strip last linebreak ## v1.11.1 2016-07-12 - this.server.options bug fix #58 (xpepermint) ## v1.11.0 2016-07-07 - Added support for LMTP protocol. Set `lmtp` option to `true` in order to use it ## v1.10.0 2016-07-06 - Added options `hidePIPELINING`, `hide8BITMIME` and `hideSMTPUTF8` ## v1.9.1 2016-04-26 - Check that `connection._parser` exists before trying to use it in the DATA handler ## v1.9.0 2016-02-20 - Added new connection method `onClose` - Preserve session object, do not re-create it for every transaction - Added new server option `allowInsecureAuth` ## v1.8.0-beta.0 2016-01-26 - Fixed a bug with XCLIENT ADDR validation - Added support for XFORWARD command - Expose XCLIENT and XFORWARD data for the session object (session.xClient, session.xForward - both are Map objects where uppercase argument name is the key, eg. session.xClient.get('ADDR') to see the IP address of XCLIENT) ## v1.7.1 2015-10-27 - Fixed an issue with empty NAME for XCLIENT ## v1.7.0 2015-10-27 - Added support for XCLIENT with `useXClient` option - Fixed an issue with an empty space after EHLO (67acb1534 by AtlasDev) - Added dummy handlers for KILL, WIZ, SHELL ## v1.6.0 2015-09-29 - Catch errors thrown by dns.reverse on invalid remoteAddress values - Added onConnect handler to block unwanted connections (66784aea by jleal52) ## v1.5.2 2015-09-18 - Fixed regression with node v0.12 where STARTTLS connections were kept hanging around after close ## v1.5.1 2015-09-18 - Fixed an issue where STARTTLS threw an error - Fixed an issue where using unknown auth schemes threw an error (a13f0bc8 by farmdog) ## v1.5.0 2015-08-21 - Added support for PROXY protocol with `useProxy` option ## v1.4.0 2015-04-30 - Added support for RFC1870 SIZE extension ## v1.3.1 2015-04-21 - Added integration tests for CRAM-MD5 authentication - Exposed SNI support with `sniOptions` optional server option - Define used protocol for NPN as 'smtp' ## v1.3.0 2015-04-21 - Added CRAM-MD5 authentication support ## v1.2.0 2015-03-11 - Do not allow HTTP requests. If the client tries to send a command that looks like a HTTP request, then disconnect - Close connection after 10 unrecognized commands - Close connection after 10 unauthenticated commands - Close all pending connections after `server.close()` has been called. Default delay to wait is 30 sec. Can be changed with `closeTimeout` option ## v1.1.1 2015-03-11 - Fixed an issue with parsing MAIL FROM and RCPT TO commands, if there was a space before or after the first colon ## v1.1.0 2015-03-09 - Added support for `hideSTARTTLS` option that hides STARTTLS while still allowing to use it (useful for integration test scenarios but not for production use) - Changed `logger` option behavior - if the value is `false` then no logging is used. If the value is missing, then output is logged to console - Fixed broken examples in the README