Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@contract-kit/provider-mail-resend

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contract-kit/provider-mail-resend

Resend mail provider for contract-kit - adds mailer port using Resend

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@contract-kit/provider-mail-resend

Resend-backed mail provider for Contract Kit.

The provider installs the app-facing ctx.ports.mailer port and exposes ctx.ports.resend.client only as an escape hatch for Resend-specific features.

Install

bun add @contract-kit/provider-mail-resend resend

Setup

import { mailResendProvider } from "@contract-kit/provider-mail-resend";
import { createServer } from "@contract-kit/server";

const server = await createServer({
  ports: basePorts,
  providers: [mailResendProvider],
  createContext: ({ ports }) => ({ ports }),
  routes,
});

Required environment variables:

VariableDescription
RESEND_API_KEYResend API key
RESEND_FROMDefault sender, e.g. My App <no-reply@example.com>

Use in application code

await ctx.ports.mailer.send({
  to: "user@example.com",
  subject: "Welcome",
  html: "<h1>Hello</h1>",
});

The same MailerPort works with SMTP, memory fakes, and other adapters:

await ctx.ports.mailer.send({
  from: { email: "support@example.com", name: "Support" },
  to: ["user@example.com", "admin@example.com"],
  replyTo: "support@example.com",
  subject: "Account updated",
  text: "Your account was updated.",
  html: "<p>Your account was updated.</p>",
});

Escape hatch

Use the Resend client only when you need a Resend-specific feature not covered by MailerPort:

await ctx.ports.resend.client.emails.send({
  from: "sender@example.com",
  to: "user@example.com",
  subject: "Invoice",
  html: "<p>Attached.</p>",
  attachments: [
    {
      filename: "invoice.pdf",
      content: pdfBuffer,
    },
  ],
});

Devtools

When ctx.ports.devtools is installed, this provider records mail.send, mail.sent, and mail.failed events under the mail watcher.

Errors

Delivery failures throw MailDeliveryError from @contract-kit/mail. Startup configuration problems throw during provider setup.

License

MIT

Keywords

contract-kit

FAQs

Package last updated on 19 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts