e-mockjs
v0.0.0
Published
A simple mock SMTP server to capture emails during testing.
Maintainers
Readme
EMock
A simple mock SMTP server to capture emails during testing.
Installation
npm install e-mockjsUsage
import EMock from "e-mockjs";
const emock = new EMock();
await emock.start();
// Send test emails here using any SMTP client,
// for example, Nodemailer:
//
// import nodemailer from "nodemailer";
// const transporter = nodemailer.createTransport({
// host: "localhost",
// port: 2525,
// secure: false
// });
// await transporter.sendMail({
// from: "[email protected]",
// to: "[email protected]",
// subject: "Test Email",
// text: "Hello from EMock!"
// });
// Retrieve emails that match a specific recipient:
const matchedEmails = EMock.findByTo("[email protected]");
console.log("Matched Emails:", matchedEmails);
await emock.stop();