JSPM

@tenfoldstudio/mailjet-adapter

0.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q35997F
  • License MIT

Mailjet Adapter for Payload

Package Exports

  • @tenfoldstudio/mailjet-adapter

Readme

Mailjet Adapter for Payload CMS

A Payload CMS email adapter for Mailjet using the official node-mailjet library.

Installation

npm install @tenfoldstudio/mailjet-adapter node-mailjet

Important: You must install node-mailjet as a dependency in your project. This package is marked as an external dependency to avoid bundling issues.

Usage

Basic Setup

import { buildConfig } from 'payload/config'
import { mailjetAdapter } from '@tenfoldstudio/mailjet-adapter'

export default buildConfig({
  // ... other config
  email: mailjetAdapter({
    apiKey: process.env.MAILJET_API_KEY!,
    apiSecret: process.env.MAILJET_API_SECRET!,
    defaultFromAddress: 'noreply@basc.aero',
    defaultFromName: 'BASC',
  }),
})

Environment Variables

Add these to your .env file:

MAILJET_API_KEY=your_mailjet_api_key
MAILJET_API_SECRET=your_mailjet_api_secret

Sending Emails

Basic Email

import { sendEmail } from '@tenfoldstudio/mailjet-adapter';

await sendEmail({
  to: 'user@example.com',
  subject: 'Welcome!',
  html: '<h1>Welcome to our app!</h1>',
  text: 'Welcome to our app!',
})

Using Mailjet Templates

await sendEmail({
  to: 'user@example.com',
  subject: 'Welcome!',
  templateId: 123456, // Your Mailjet template ID
  data: {
    name: 'John Doe',
    company: 'Acme Corp',
  },
})

With Attachments

`