Scan your whole stack
From OX Research Newsroom
Are you using @sdxc/mail?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2026.11.29
@sdxc/mail was last scanned on 29 Nov 2026 at version 2026.11.29. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2026.11.29 LATEST | 29 Nov 2026 | No rules fired |
| 2026.11.27 | 27 Nov 2026 | No rules fired |
| 2026.11.26 | 26 Nov 2026 | No rules fired |
| 2026.11.18 | 18 Nov 2026 | Not shown |
| 2026.11.17 | 17 Nov 2026 | Not shown |
Findings for v2026.11.29. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2026.11.29; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Transport-agnostic transactional email with pluggable transports and remix/component rendering.
A Mailer applies sender defaults, coerces addresses, derives the plain-text part and validates
each message, then hands it to a Transport, the only piece that knows a provider. send()
answers a Result and never throws.
npm add @sdxc/mail
Outcomes are Results from @sdxc/result and
bodies are remix/component trees from remix. The
middleware logs through @sdxc/logger, and
./markdown renders documents from @sdxc/markdown
painted by @sdxc/highlight.
import { Mailer } from "@sdxc/mail";
import { MemoryTransport } from "@sdxc/mail/memory";
import { isFailure } from "@sdxc/result";
let mailer = new Mailer({
transport: new MemoryTransport(),
from: { email: "no-reply@example.com", name: "Example" },
replyTo: { email: "hello@example.com" },
});
let result = await mailer.send({
to: { email: "user@example.com" },
subject: "You have been invited",
html: "<p>Welcome aboard.</p>",
});
if (isFailure(result)) console.warn(result.error.message);
The plain-text part is derived from the HTML, so every message ships both.
An app declares every email it sends, and the schema of its props, in one map. Importing the map costs the schemas alone, so a sender never loads the module that renders an email:
// app/emails/index.ts
import { email, emails } from "@sdxc/mail";
import * as s from "remix/data-schema";
export default emails({
teams: { invite: email({ props: s.object({ team: s.string(), url: s.string() }) }) },
});
// app/emails/teams/invite.tsx
import { createEmail, Email } from "@sdxc/mail";
export default createEmail(emails.teams.invite, {
subject: ({ team, t }) => t("emails.teamInvite.subject", { team }),
body: (handle) => () => (
<Email.Layout lang={handle.props.locale} title={handle.props.team}>
<Email.Button href={handle.props.url}>
{handle.props.t("emails.teamInvite.action")}
</Email.Button>
</Email.Layout>
),
preview: () => ({ team: "Acme", url: "https://example.com/invite/1" }),
});
// app/initializers/mail.ts
import { createMail, lazy } from "@sdxc/mail";
export const mail = createMail({ translator: translate });
mail.map(
emails.teams.invite,
lazy(() => import("~/app/emails/teams/invite")),
);
A mailer configured with the registry as mail sends a declared email by its declaration, with
the recipient, the reader's language and the props:
await ctx.email.send(emails.teams.invite, { to, locale, props: { team, url } });
ctx.email.later(emails.teams.invite, { to, locale, props: { team, url } });
await ctx.email.queue(emails.teams.invite, { to, locale, props: { team, url } });
The props are parsed by the declared schema first, and copy is translated when the email
renders: subject, body and the other members receive the props with locale and t beside
them, from the registry's translator (createTranslator() from @sdxc/i18n fits). Augment
MailTypes with translate so t() checks message keys. preview() is optional and only feeds
mail.preview(), which previews(mail, { locales }) from @sdxc/mail/previews serves at
/_emails while developing.
queue() hands the delivery, as plain JSON, to the mailer's queue option. One job delivers
every queued email:
// app/jobs/index.ts
export default jobs({ email: job({ input: EMAIL_DELIVERY }) });
// app/jobs/email.ts
export default createJobHandler(jobs.email, async (ctx) => {
let sent = await ctx.email.deliver(ctx.input);
if (isFailure(sent) && sent.error instanceof EmailRefusedError) ctx.exit(sent.error.message);
if (isFailure(sent)) ctx.retry({ cause: sent.error });
});
Mail that is no declared email, such as a message to the app's own inbox, can be any object
with to, subject and body(); replyTo, headers, unsubscribe, list and calendar
are optional members of the same Email contract.
import { Email } from "@sdxc/mail";
await mailer.send({
to: { email: "support@example.com" },
subject: `[Support] ${request.topic}`,
replyTo: { email: request.email },
body: () => (
<Email.Layout title="Support request">
<Email.Text>{request.message}</Email.Text>
</Email.Layout>
),
});
import { CloudflareTransport } from "@sdxc/mail/cloudflare";
import mailer from "@sdxc/mail/middleware";
import { env } from "cloudflare:workers";
import { createRouter } from "remix/router";
let router = createRouter({
middleware: [
mailer({
transport: new CloudflareTransport(env.EMAIL),
from: { email: "no-reply@example.com", name: "Example" },
mail,
queue,
}),
],
});
router.post("/invites", async (context) => {
context.email.later(emails.teams.invite, { to: invite.email, props: invite });
return new Response(null, { status: 204 });
});
context.email is a request-scoped Mailer; what later() queued is sent once the response
is produced, and each outcome lands on the invocation's log.
import { isComposedEmail, Mailer } from "@sdxc/mail";
import { MemoryTransport } from "@sdxc/mail/memory";
let transport = new MemoryTransport();
let mailer = new Mailer({ transport, from: { email: "no-reply@example.com" }, mail });
await mailer.send(emails.teams.invite, { to: invite.email, props: invite });
let sent = transport.find((message) => isComposedEmail(message.email, emails.teams.invite));
expect(sent?.text).toContain(invite.url);
Recorded messages are the normalized ones a provider receives: defaults applied, address lists coerced and the text part derived.
new Mailer(options: MailerOptions)A mailer bound to one transport and sender identity. options holds transport, from, and
optionally replyTo and headers; per-message headers win over headers.
mailer.send(input: Message | Email, overrides?: SendOptions): Promise<Result<SentMessage, MailError>>Normalizes and delivers one message. A render failure, an invalid message, a rejected delivery
and a throwing transport all answer a MailError failure. overrides replace fields for this
send only.
mailer.later(input: Message | Email, overrides?: SendOptions): voidQueues a message for the next flush(); rendering and validation happen at flush time.
mailer.flush(): Promise<Result<SentMessage, MailError>[]>Sends and empties the queue, answering one result per message in queue order. The middleware calls it for you.
mailer.pending: numberHow many messages wait for the next flush().
mailer.queue(email, delivery): Promise<Result<void, MailError>>Validates a declared email's props and hands the delivery, with the email's name, to the
queue option. Fails without a mail registry or a queue.
mailer.deliver(queued: QueuedEmail): Promise<Result<SentMessage, MailError>>Sends a delivery queue() produced. An EmailRefusedError (unmapped name, refused props) means
no retry can send it.
email({ props }) and emails(tree)Declare emails by the schema of their props; each declaration is named by its path
(teams.invite), which a queued delivery carries.
createEmail(email, options): EmailTemplatePairs a template with its declaration: subject, body, and optional replyTo, headers,
unsubscribe, list, calendar and preview.
createMail(options?: MailOptions): MailThe registry: map(email, template | lazy(load)), mapped, compose(), render(email, { locale, props }),
preview(email, locale?), hasPreview(email) and validate(email, props). It holds no transport, so a command run
on Bun and the Worker share it.
EMAIL_DELIVERYThe input schema of the job that delivers queued email.
isComposedEmail(email, declaration?)Whether a sent message's email was composed from a declaration, for picking it out of a
memory transport in a test.
render(element: RemixElement): Promise<RenderedEmail>Renders a body tree to { html, text }, deriving text from the HTML. A whole document gets
an XHTML 1.0 Transitional doctype, which keeps Outlook out of quirks mode.
buildMimeMessage(message: NormalizedMessage): stringAssembles a raw RFC 5322 message for a provider that takes MIME. Bodies go into
multipart/alternative ordered text, HTML, calendar (a single part ships without a boundary);
headers fold at 78 characters, non-ASCII names and subjects become RFC 2047 encoded words, each
part is quoted-printable or base64, whichever is smaller, line endings are CRLF, and Bcc is
left to the envelope.
isEmail(value: Message | Email): value is Emailtrue when the value has a callable body, the one member only an Email has.
formatAddress(address: Address): stringAn RFC 5322 mailbox: user@example.com, or Name <user@example.com> with the name quoted when
it needs to be.
toAddressList(value: Address | Address[] | undefined): Address[]A new array from the single-or-list shape callers write; undefined becomes [].
htmlToText(html: string): stringThe plain-text alternative of rendered HTML: links become label (href), images their alt
text, lists keep numbers or bullets, and table rows become lines. Elements marked
data-skip-in-text are dropped.
MailErrorThe error of every failed send, with the provider or render error kept as cause.
Email layout kitUnbranded components laid out with inline-styled tables, every color a prop.
| Component | Props |
|---|---|
Email.Layout |
preview?, logo?, title?, lang?, background?, surface?, color?, fontFamily?, fonts?, width?, darkStyles?, children? |
Email.Heading |
level? (1 \| 2 \| 3), color?, align?, children? |
Email.Text |
color?, muted?, size?, align?, children? |
Email.Link |
href, color?, underline?, children? |
Email.CodeInline |
children? |
Email.Section |
padding?, background?, align?, children? |
Email.Row |
gap?, children? (Email.Columns side by side, no wrapping) |
Email.Column |
width?, align?, valign?, padding?, children? |
Email.Button |
href, background?, color?, radius?, children? |
Email.Table |
rows (EmailTableRow[]), borderColor? |
Email.Img |
src, alt, width?, height?, radius?, gap? |
Email.Hr |
color?, gap? |
Email.Footer |
color?, borderColor?, children? |
Email.Layout renders the document, its only <head> and <style>, the hidden preview
preheader, and a dark-mode stylesheet. Email.MONO_FAMILY and Email.CODE_COLOR are the font
stack and fill the code components use.
Message: what a caller writes: to, subject, html and/or text, and optionally from,
cc, bcc, replyTo, headers, date, messageId, unsubscribe, list and calendar.
Address fields take an Address or a list.Email: an email class: to, subject and body(): RemixElement, plus optional replyTo,
headers, unsubscribe, list and calendar.NormalizedMessage: what a transport receives: address fields as lists, date and
messageId always set, the derived text, the generated List-* headers, unsubscribe and
list as the option or null, and email holding the source Email when there was one.Transport: { send(message: NormalizedMessage): Promise<Result<SentMessage, MailError>> }.SentMessage: { messageId }, the provider's id or the message's own Message-ID.Address: { email, name? }.Unsubscribe: { url, mailto?, oneClick? }; url must be https:, mailto is an address
or a mailto: URI, and oneClick (default true) writes List-Unsubscribe-Post.MailingList: { id, name? }, written as List-Id.CalendarPart: { method, content, filename? }, an iCalendar object whose method matches
its METHOD; filename also attaches it as a file.MailerOptions, SendOptions (Partial<Message>), RenderedEmail ({ html, text }),
EmailTableRow ({ label, value }) and EmailFont (family, fallback, and optional
src: { url, format }, weight and style).@sdxc/mail/markdownMarkdownRenders a parsed @sdxc/markdown document (document prop) through the layout kit. Headings
stop at level three, alerts become labelled quotes, footnotes become labelled blocks, and raw
HTML arrives as escaped text.
CodeBlockA highlighted code block in a single-cell table. Props: code, language?, tokens?; without
tokens it highlights itself, and an unknown language renders unpainted.
@sdxc/mail/memorynew MemoryTransport(options?: MemoryTransportOptions)Records every delivery instead of sending it. options.mime: true also records the raw
message. Members: messages, last, deliveries (RecordedDelivery[], each
{ message, mime? }), lastMime, find(predicate) and clear().
@sdxc/mail/printnew PrintTransport(options: PrintTransportOptions)Writes each message to options.write instead of sending it, and reports it sent: the envelope,
subject, date, Message-ID and extra headers, then the plain-text body. options.mime: true
writes the raw MIME message instead. It writes only through the function it is given, so it runs
anywhere: ctx.stderr in a command, (text) => process.stderr.write(text) in a script.
@sdxc/mail/cloudflarenew CloudflareTransport(binding: SendEmailBinding)Delivers through the Workers
send_email binding.
The binding writes its own Date and Message-ID, ships the first replyTo only, and receives
a calendar as a text/calendar attachment named by filename or invite.ics.
SendEmailBinding, SendEmailMessage, SendEmailAttachment and SendEmailResult type the
binding.
@sdxc/mail/middlewaremail(options: MailMiddlewareOptions): Middleware (default export)Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.