Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nixfo/smtp-stub

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nixfo/smtp-stub

SMTP server stub

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

smtp-stub

This project is intended to be used for development purpose only, to simulate a SMTP server and view the received emails. It also contains utilities for easy automated testing.

Usage

Install smtp-stub in your project in dev dependencies

npm i -D @nixfo/smtp-stub

Install smtp-stub globally

npm i -g @nixfo/smtp-stub

Run the servers

npx @nixfo/smtp-stub

Then you will be able to :

  • Send your emails to the SMTP port at localhost:1025.
  • View your emails at localhost:1024.
  • Clear your emails sending a DELETE request at localhost:1024.

Use smtp-stub for automated tests

Construct your SmtpStubServer via the SmtpStubBuilder.

const smtpStub =
    new SmtpStubBuilder(1025, '0.0.0.0') // Port/host of the SMTP server
        .withWebServer(1024, '0.0.0.0')  // (optional) include a web server to visualize received emails
        .build();                        // Build and returns the object

Check the result

expect(smtpStub.emails.length).toBe(1);

If you want to close the servers

smtpStub.close();

FAQs

Package last updated on 15 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc