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 = Server;const server = 25 /* port */;server;
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 = ;const client = ;client;
All listeners receive a single response, a
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:
The server emits emails as UTF8-encoded JSON to all clients, using