Skip to content

About

Official Payload CMS email adapter for eusend — EU-native transactional email, sent and stored in the EU.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

@eusend_dev/payload-email

Payload CMS email adapter for eusend — EU-native transactional email, sent and stored inside the EU.

It talks to the eusend REST API rather than SMTP, so it works on serverless the way @payloadcms/email-nodemailer does not.

npm install @eusend_dev/payload-email
import { buildConfig } from 'payload'
import { eusendAdapter } from '@eusend_dev/payload-email'

export default buildConfig({
  email: eusendAdapter({
    apiKey: process.env.EUSEND_API_KEY || '',
    defaultFromAddress: 'hello@yourdomain.com',
    defaultFromName: 'Your app',
  }),
})

Every email Payload sends — verification, password reset, and anything you send yourself with payload.sendEmail() — then goes through eusend.

Options

Option Required What it does
apiKey yes An eusend API key.
defaultFromAddress yes Sender used when a message sets no from. Its domain must be verified on your eusend account.
defaultFromName yes Display name paired with defaultFromAddress.
overrideRecipientAddress no Redirect every message to one address. cc and bcc are dropped with the real recipients.
tags no Tags added to every send, e.g. { source: 'payload' }. They filter the log and reach webhooks.
trackOpens / trackClicks no Per-adapter tracking overrides. Defaults to whatever the account is configured for.
baseUrl no Override the API host. Only useful against a staging deployment.

Attachments

payload.sendEmail() takes nodemailer's attachment shape, and all four forms work:

await payload.sendEmail({
  to: 'customer@example.com',
  subject: 'Your invoice',
  html: '<p>Attached.</p>',
  attachments: [
    { filename: 'invoice.pdf', content: pdfBuffer }, // raw bytes
    { filename: 'notes.txt', content: 'plain text' }, // encoded for you
    { path: 'https://example.com/invoice.pdf' }, // fetched at send time
    { path: '/var/data/invoice.pdf' }, // read from disk
  ],
})

A string content is read as UTF-8 unless you pass encoding: 'base64', matching nodemailer rather than assuming the string is already base64. Set cid to reference an attachment from your HTML as <img src="cid:...">.

Errors

A failed send throws Payload's APIError with the HTTP status and the eusend error code:

Error sending email: DOMAIN_NOT_VERIFIED - Domain not verified

The error-code reference explains each one.

Links

MIT

About

Official Payload CMS email adapter for eusend — EU-native transactional email, sent and stored in the EU.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages