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

simple-smtp-listener

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-smtp-listener

A simple SMTP listen server

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

simple-smtp-listener

A NodeJS script that acts as a simple SMTP listen server. Accepts all emails, and emits them both as an EventEmitter and through a socket.

Usage (single access)

If only 1 script needs to receive mails:

const SMTPServer = require("simple-smtp-listener").Server;
const server = new SMTPServer(25 /* port */);
server.on("test@example.com", (mail)=>{
    ...
});

Usage (multi access)

If multiple scripts need to receive mails, create a symlink at /var/dev/simple-smtp-listener/ pointing to the working directory, then create a symlink at /etc/systemd/system/simple-smtp-listener.service pointing to ./service/simple-smtp-listener.service. Finally run sudo systemctl start simple-smtp-listener. This starts the server and keeps it running should it crash.

If you aren't running systemd, do the equivalent on your system.

Then in your scripts do

const SMTPClient = require("simple-smtp-listener");
const client = new SMTPClient();
client.on("test@example.com", ()=>{
    ...
});

Mail object

All listeners receive a single response, a Mail object. This is simply the email parsed by Nodemailer's Mailparser. See their documentation for details.

Socket

If you need access to mails from non-JS code (or you don't want to use SMTPClient), you can instead listen to the UNIX/Windows socket (default UNIX location: /tmp/app.simple-smtp-listener).

The server emits emails as UTF8-encoded JSON to all clients, using node-ipc.

Keywords

FAQs

Package last updated on 29 Jun 2023

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