@pageloop/mail
v0.6.1
Published
`MailAdapter` implementations for the [PageLoop](https://github.com/rw3iss/pageloop) server — a dependency-free console default plus provider-backed adapters whose SDKs are optional peer deps, so each only loads when you import its subpath.
Downloads
512
Readme
@pageloop/mail
MailAdapter implementations for the PageLoop
server — a dependency-free console default plus provider-backed adapters whose
SDKs are optional peer deps, so each only loads when you import its subpath.
Install
pnpm add @pageloop/mailThe console adapter needs nothing else. For the provider subpaths, add the
matching optional peer dependency: resend for /resend, nodemailer for
/smtp.
Exports
| Subpath | Use when | Peer dep |
|---|---|---|
| . | createConsoleMailAdapter() — no-op that logs every email to the console. The self-host / dev / test default. | none |
| /resend | createResendAdapter(...) — sends via the Resend HTTP API. | resend |
| /smtp | createSmtpAdapter(...) (any SMTP host) + createResendSmtpAdapter(...) (Resend-over-SMTP convenience). | nodemailer |
Each factory returns a MailAdapter you pass to new Application({ mail }).
. — console (default)
import { createConsoleMailAdapter } from '@pageloop/mail';
const mail = createConsoleMailAdapter(); // logs to stdout instead of sending/resend — Resend HTTP API
import { createResendAdapter } from '@pageloop/mail/resend';
const mail = createResendAdapter({
apiKey: process.env.RESEND_API_KEY!,
defaultFrom: 'PageLoop <[email protected]>',
defaultReplyTo: '[email protected]', // optional
});/smtp — generic SMTP via nodemailer
createSmtpAdapter speaks any SMTP host (Brevo, SES, Postmark, self-hosted
Postfix, …):
import { createSmtpAdapter, createResendSmtpAdapter } from '@pageloop/mail/smtp';
const mail = createSmtpAdapter({
host: 'smtp.example.com',
port: 587, // STARTTLS; `secure` auto-derives from the port
user: 'apikey',
pass: process.env.SMTP_PASS!,
defaultFrom: 'PageLoop <[email protected]>',
});
// Or the Resend-over-SMTP convenience (fixed host/user; defaults to port 587):
const resendSmtp = createResendSmtpAdapter({
apiKey: process.env.RESEND_API_KEY!,
defaultFrom: 'PageLoop <[email protected]>',
});