@meridianjs/email-resend
v1.0.0
Published
Resend email provider module for Meridian
Downloads
308
Readme
@meridianjs/email-resend
Resend email provider for MeridianJS. Registers an emailService in the DI container that implements the IEmailService interface.
Installation
npm install @meridianjs/email-resendConfiguration
// meridian.config.ts
export default defineConfig({
modules: [
{
resolve: "@meridianjs/email-resend",
options: {
apiKey: process.env.RESEND_API_KEY ?? "",
fromAddress: process.env.EMAIL_FROM ?? "[email protected]",
},
},
],
})Add to your .env:
RESEND_API_KEY=re_your_api_key
[email protected]Usage
Resolve emailService from the container in a subscriber, route, or job:
import type { IEmailService } from "@meridianjs/types"
const emailSvc = container.resolve("emailService") as IEmailService
await emailSvc.send({
to: "[email protected]",
subject: "You have been added to a workspace",
html: "<p>Welcome to <strong>Acme Corp</strong>!</p>",
text: "Welcome to Acme Corp!",
})Notes
- Both
htmlandtextare optional — pass at least one. - Errors from the Resend API are rethrown as
Errorinstances.
License
MIT
