Socket
Socket
Sign inDemoInstall

fake-smtp-server

Package Overview
Dependencies
105
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fake-smtp-server

Fake SMTP Server for email testing


Version published
Weekly downloads
2K
decreased by-13.44%
Maintainers
1
Install size
13.5 MB
Created
Weekly downloads
 

Readme

Source

Fake SMTP Server

Fake SMTP Server is an email testing tool for QA & development teams. It allows manual testing in a web interface, and automated testing via an API.

API

Listing all received emails

Received mails are listed on http://localhost:1080/api/emails, and looks like this:

[
  {
    "attachments": [],
    "text": "Hi Bob!",
    "textAsHtml": "<p>Hi Bob!</p>",
    "subject": "Hi",
    "date": "2017-09-18T16:12:16.000Z",
    "to": {
      "value": [
        {
          "address": "bob@example.com",
          "name": "Bob"
        }
      ],
      "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">Bob</span> &lt;<a href=\"mailto:bob@example.com\" class=\"mp_address_email\">bob@example.com</a>&gt;</span>",
      "text": "Bob <bob@example.com>"
    },
    "from": {
      "value": [
        {
          "address": "joe@example.com",
          "name": "Joe"
        }
      ],
      "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">Joe</span> &lt;<a href=\"mailto:joe@example.com\" class=\"mp_address_email\">joe@example.com</a>&gt;</span>",
      "text": "Joe <joe@example.com>"
    },
    "messageId": "<1433879119.43.1505751136615@[10.143.108.87]>",
    "html": false
  }
]

You can filter emails with the following parameters:

  • from: filter sender
  • to: filter recipient
  • since: filter email date
  • until: filter email date

Example:

    GET http://localhost:1080/api/emails?from=joe@example.com&to=bob@example.com&since=2017-09-18T12:00:00Z&until=2017-09-19T00:00:00Z
Viewing headers in responses

By default, fake-smtp-server will not capture custom headers in emails. To enable headers, start the server with the --headers flag. If enabled, headers will be serialized as an object type.

For reference for what headers look like, consult Nodemailer's documentation, but keep in mind that the HTTP endpoint returns plain JSON objects rather than Maps.

Removing all received email

To remove all emails without restarting the server:

    DELETE http://localhost:1080/api/emails

Web interface

Go to http://localhost:1080

Install

  npm install -g fake-smtp-server

Usage

Usage:
  fake-smtp-server [OPTIONS] [ARGS]

Options:
  -s, --smtp-port [NUMBER] SMTP port to listen on (Default is 1025)
      --smtp-ip [IP]       IP Address to bind SMTP service to (Default is 0.0.0.0)
  -h, --http-port [NUMBER] HTTP port to listen on (Default is 1080)
      --http-ip [IP]       IP Address to bind HTTP service to (Default is 0.0.0.0)
  -w, --whitelist STRING   Only accept e-mails from these adresses. Accepts
                           multiple e-mails comma-separated
  -m, --max [NUMBER]       Max number of e-mails to keep (Default is 100)
  -a, --auth STRING        Enable Authentication
      --headers            Enable headers in responses
  -k, --no-color           Omit color from output
      --debug              Show debug information

Keywords

FAQs

Last updated on 19 Dec 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc