@nwire/mail-nodemailer
v0.7.1
Published
Nwire — Nodemailer-backed mail adapter. Implements the Mailer contract via nodemailer's transporter (SMTP/Mailhog/Gmail/Office365/...). Health-checked with transporter.verify(); graceful shutdown closes the pool.
Downloads
40
Readme
@nwire/mail-nodemailer
Nodemailer-backed
Mailer— SMTP, Mailhog, Gmail, Office365.
What it does
Wraps a nodemailer Transporter so handlers can send mail through the canonical Mailer contract without knowing whether they're talking to Mailhog, Postfix, or a cloud relay.
Install
pnpm add @nwire/mail-nodemailer @nwire/mail nodemailerQuick start
import { smtpMailer } from "@nwire/mail-nodemailer";
import { mailPlugin } from "@nwire/mail";
import { defineApp } from "@nwire/forge";
defineApp("my-app", {
plugins: [
mailPlugin({
mailer: smtpMailer({
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
auth: { user: process.env.SMTP_USER!, pass: process.env.SMTP_PASS! },
}),
defaultFrom: '"My App" <[email protected]>',
}),
],
});
// Local dev:
// smtpMailer({ host: "localhost", port: 1025 }) // Mailhog (no auth)API surface
smtpMailer(transporterOptions)— implementsMailerusing a nodemailer transport.
When to use
Production transactional mail or local-dev with Mailhog (nwire infra up ships Mailhog at http://localhost:8025).
Within nwire-app
For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).
import { createApp } from "@nwire/forge";
const app = createApp({
/* ...config... */
});
// Adapter/plugin wiring happens here when applicable.