0.0.7 • Published 6 months ago

@nixfo/smtp-stub v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

smtp-stub

npm version Build Status Downloads

smtp-stub is a tool for simulating a SMTP server for development and automated testing environments.

Features

  • Simulate an SMTP server
  • View received emails via a web interface
  • Easy integration for automated tests

Installation

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

Usage

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();
0.0.7

6 months ago

0.0.6

11 months ago

0.0.5-fix

11 months ago

0.0.5

11 months ago

0.0.4-cjs

11 months ago

0.0.3-cjs

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

12 months ago