mirror of
https://github.com/hanzo-apps/cms.git
synced 2026-10-30 14:47:33 +00:00
- payload -> @hanzo/cms (core), bin payload -> hanzo-cms - create-payload-app -> @hanzo/create-cms-app - @payloadcms/<x> -> @hanzo/cms-<x> across the whole dependency graph - 3545 files, 72 package.json, 4419 scoped refs, 3852 core import specifiers, 82 scss imports - MIT attribution to Payload CMS Inc. preserved (LICENSE.md, author emails) Upstream: github.com/payloadcms/payload @ v3.85.2 (MIT)
1.9 KiB
1.9 KiB
Nodemailer Email Adapter for Payload
This adapter allows you to send emails using the Nodemailer library.
It abstracts all of the email functionality that was in Payload by default in 2.x into a separate package.
NOTE: Configuring email in Payload 3.0 is now completely optional. However, you will receive a startup warning that email is not configured and also a message if you attempt to send an email.
Installation
pnpm add @hanzo/cms-email-nodemailer nodemailer
Usage
Using nodemailer.createTransport
import { nodemailerAdapter } from '@hanzo/cms-email-nodemailer'
import nodemailer from 'nodemailer'
export default buildConfig({
email: nodemailerAdapter({
defaultFromAddress: '[email protected]',
defaultFromName: 'Payload',
// Any Nodemailer transport
transport: await nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
}),
}),
})
Using transportOptions
import { nodemailerAdapter } from '@hanzo/cms-email-nodemailer'
export default buildConfig({
email: nodemailerAdapter({
defaultFromAddress: '[email protected]',
defaultFromName: 'Payload',
// Nodemailer transportOptions
transportOptions: {
host: process.env.SMTP_HOST,
port: 587,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
},
}),
})
During development, if you pass nothing to nodemailerAdapter, it will use the ethereal.email service.
This will log the ethereal.email details to console on startup.
import { nodemailerAdapter } from '@hanzo/cms-email-nodemailer'
export default buildConfig({
email: nodemailerAdapter(), // This will be the old ethereal.email functionality
})