Payload
Send Payload's emails, such as password resets and email verification, through Wakio.
npm install wakio
// payload.config.ts
import { buildConfig } from "payload"
import { wakioAdapter } from "wakio/payload"
export default buildConfig({
email: wakioAdapter({
defaultFromAddress: "[email protected]",
defaultFromName: "Acme",
}),
})
defaultFromAddress must be on one of your sending domains. The adapter reads WAKIO_API_KEY when it sends.
When you call payload.sendEmail yourself:
- Give
to,ccandbccas an address, a named address likeMaya Lee <[email protected]>, a{ name, address }object, or a list of them. Put a name that contains a comma in double quotes. GivereplyToas a bare address: Wakio refuses a name there. - Give attachments their content and a
contentType. A file given bypathis refused with an error naming it, because the adapter does not read your disk. - Set an
X-Wakio-Idempotency-Keyheader to make a send idempotent. Wakio removes the header before sending; any other custom header is refused.
If every address is suppressed, sendEmail throws WakioSuppressedError.
Templates are set up with Wakio for now: email [email protected].