feat: add email service config from .env

This commit is contained in:
Yehoshua Sandler 2025-05-03 17:13:02 -05:00
parent bce3a7c23e
commit 2b9d35b7a7
2 changed files with 17 additions and 0 deletions

View File

@ -1,2 +1,6 @@
DATABASE_URI=postgres://postgres:<password>@127.0.0.1:5432/your-database-name DATABASE_URI=postgres://postgres:<password>@127.0.0.1:5432/your-database-name
PAYLOAD_SECRET=YOUR_SECRET_HERE PAYLOAD_SECRET=YOUR_SECRET_HERE
SMTP_HOST=
SMTP_USER=
SMTP_PASS=
SMTP_PORT=587

View File

@ -1,6 +1,7 @@
// storage-adapter-import-placeholder // storage-adapter-import-placeholder
import { postgresAdapter } from '@payloadcms/db-postgres' import { postgresAdapter } from '@payloadcms/db-postgres'
import { lexicalEditor } from '@payloadcms/richtext-lexical' import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
import path from 'path' import path from 'path'
import { buildConfig } from 'payload' import { buildConfig } from 'payload'
import { fileURLToPath } from 'url' import { fileURLToPath } from 'url'
@ -48,6 +49,18 @@ export default buildConfig({
connectionString: process.env.DATABASE_URI || '', connectionString: process.env.DATABASE_URI || '',
}, },
}), }),
email: nodemailerAdapter({
defaultFromAddress: 'no-reply@beitzah.net',
defaultFromName: 'no-reply Beitzah',
transportOptions: {
host: process.env.SMTP_HOST,
port: parseInt(process.env.SMTP_PORT || '', 10),
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
},
}),
sharp, sharp,
plugins: [ plugins: [
//payloadCloudPlugin(), //payloadCloudPlugin(),