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

@danielres/smtp-mini-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danielres/smtp-mini-dev-server - npm Package Compare versions

Comparing version 1.4.4 to 1.4.5

20

index.js

@@ -9,2 +9,4 @@ #!/usr/bin/env node

let mailbox = {};
const PORT = process.env.DEV_SMTP_PORT || 2500;

@@ -15,3 +17,6 @@ const API_PORT = process.env.DEV_SMTP_API_PORT || 2501;

let mailbox = {};
const filterByTo = (to, mailbox) =>
Object.entries(mailbox)
.filter(([k, v]) => v.to.value.filter((v) => v.address === to).length > 0)
.map(([k, v]) => ({ id: k, ...v }));

@@ -28,3 +33,3 @@ const smtp = new SMTPServer({

let result = "";
stream.on("data", chunk => (result += chunk));
stream.on("data", (chunk) => (result += chunk));
stream.on("end", () => {

@@ -36,7 +41,6 @@ simpleParser(result, {}, (err, parsed) => {

});
}
},
});
app.get("/", (req, res) => {
const headers = ["messageId", "from", "to", "subject"];
const messages = Object.values(mailbox).reverse();

@@ -46,2 +50,8 @@ res.send(templates.home({ messages }));

app.get("/to/:to", (req, res) => {
console.log(JSON.stringify(mailbox, null, 2));
const { to } = req.params;
res.json(filterByTo(to, mailbox).reverse());
});
app.get("/:messageId", (req, res) => {

@@ -56,3 +66,3 @@ res.json(mailbox[req.params.messageId]);

smtp.on("error", err => {
smtp.on("error", (err) => {
console.error("Error %s", err.message);

@@ -59,0 +69,0 @@ });

@@ -24,3 +24,3 @@ {

],
"version": "1.4.4",
"version": "1.4.5",
"main": "index.js",

@@ -27,0 +27,0 @@ "license": "MIT",

@@ -11,2 +11,9 @@ # SMTP mini dev server

## Features
- Simple, fast, lightweight.
- Convenient for e2e testing (Cypress, puppeteer, ...).
- Allows developers, testers, product managers to inspect sent emails, but guarantees no development/test/staging emails ever get sent to real recipients.
- Faster than using third-party services.
## Installation

@@ -28,3 +35,3 @@

Example: \
`DEV_SMTP_PORT=1234 DEV_SMTP_API_PORT=1235 yarn dev`
`DEV_SMTP_PORT=1234 DEV_SMTP_API_PORT=1235 yarn smtp-dev`

@@ -31,0 +38,0 @@ ## Example usage with nodemailer (in non-production environments)

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