@redwoodjs/mailer-handler-resend
TypeScript icon, indicating that this package has built-in type declarations

7.7.1 • Public • Published

Mailer - Handler - Resend

Prerequisites

We assume you have the basic boilerplate for the redwood mailer present. We also assume that you have signed up with Resend and have access to an API key.

Setup

We should install this handler package as a production dependency of the API side. We can do this with the following command:

yarn workspace api add @redwoodjs/mailer-handler-resend

After this you should be able to import this handler into your api/src/lib/mailer.ts file and create an instance of this handler with your API key.

import { ResendMailHandler } from '@redwoodjs/mailer-handler-resend'

// ...

const handlers = {
  // ...
  resend: new ResendMailHandler({
    apiKey: process.env.RESEND_API_KEY,
  }),
  // ...
}

// ...

export const mailer = new Mailer({
  // ...
  handlers,
  // ...
})

If you need access to the underlying resend client to perform more specific behaviour the SDK exposes you can always access this using the internal function on this resend handler.

const resendHandler = mailer.handlers.resend
const resendClient = resendHandler.internal().client

Usage

You should be able to use this newly configured handler like any other previous handler and should require no changes to your mailer code.

Readme

Keywords

none

Package Sidebar

Install

npm i @redwoodjs/mailer-handler-resend

Weekly Downloads

11,826

Version

7.7.1

License

MIT

Unpacked Size

10.2 kB

Total Files

7

Last publish

Collaborators

  • joshgmw
  • selfteachme
  • tobbe
  • desaadi
  • mojombo
  • dac09
  • thedavidprice