payload-email-brevo
v1.0.0
Published
Payload CMS email adapter for the Brevo (Sendinblue) transactional REST API
Downloads
253
Maintainers
Readme
payload-email-brevo
Payload CMS email adapter for the Brevo (formerly Sendinblue) transactional email REST API.
Modeled after @payloadcms/email-resend.
Install
pnpm add payload-email-brevoUsage
- Create a Brevo account and verify a sender domain
- Create an API key
- Set
BREVO_API_KEY(or passapiKeyexplicitly) - Configure Payload:
import { brevoAdapter } from 'payload-email-brevo'
export default buildConfig({
email: brevoAdapter({
defaultFromAddress: '[email protected]',
defaultFromName: 'Example',
apiKey: process.env.BREVO_API_KEY || '',
// Optional: use a Brevo transactional template by default
defaultTemplateId: Number(process.env.BREVO_TEMPLATE_ID) || undefined,
}),
})Plain HTML (default)
await payload.sendEmail({
to: '[email protected]',
subject: 'Hello',
html: '<p>Hi</p>',
text: 'Hi',
})Brevo template (optional)
Pass templateId + params for a designed template. When set, Brevo ignores html/text.
import type { BrevoSendEmailMessage } from 'payload-email-brevo'
await payload.sendEmail({
to: '[email protected]',
subject: 'Blog draft ready',
templateId: 12,
params: {
message: 'Your draft is ready in the admin panel.',
},
} as BrevoSendEmailMessage)Options
| Option | Required | Description |
| --- | --- | --- |
| apiKey | yes | Brevo API key |
| defaultFromAddress | yes | Default sender address |
| defaultFromName | yes | Default sender name |
| defaultTemplateId | no | Brevo transactional template used when a send does not pass templateId |
| overrideRecipientAddress | no | Override all recipients (useful for testing) |
API
Sends via POST https://api.brevo.com/v3/smtp/email with the api-key header.
See Brevo docs.
License
MIT
