mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-11 00:33:23 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cf055178b | ||
| aa978090fa | |||
|
|
556d910e30 | ||
| b4bad70634 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/payload-mailing",
|
"name": "@xtr-dev/payload-mailing",
|
||||||
"version": "0.1.21",
|
"version": "0.1.23",
|
||||||
"description": "Template-based email system with scheduling and job processing for PayloadCMS",
|
"description": "Template-based email system with scheduling and job processing for PayloadCMS",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -29,11 +29,8 @@ export class MailingService implements IMailingService {
|
|||||||
const emailsConfig = config.collections?.emails
|
const emailsConfig = config.collections?.emails
|
||||||
this.emailsCollection = typeof emailsConfig === 'string' ? emailsConfig : 'emails'
|
this.emailsCollection = typeof emailsConfig === 'string' ? emailsConfig : 'emails'
|
||||||
|
|
||||||
// Only initialize transporter if payload is properly set
|
|
||||||
if (payload && payload.db) {
|
|
||||||
this.initializeTransporter()
|
this.initializeTransporter()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private initializeTransporter(): void {
|
private initializeTransporter(): void {
|
||||||
if (this.transporterInitialized) return
|
if (this.transporterInitialized) return
|
||||||
@@ -48,6 +45,7 @@ export class MailingService implements IMailingService {
|
|||||||
// Use Payload's configured mailer (cast to any to handle different adapter types)
|
// Use Payload's configured mailer (cast to any to handle different adapter types)
|
||||||
this.transporter = this.payload.email as any
|
this.transporter = this.payload.email as any
|
||||||
} else {
|
} else {
|
||||||
|
console.log('[DEBUG] email: ', this.payload.email);
|
||||||
throw new Error('Email transport configuration is required either in plugin config or Payload config')
|
throw new Error('Email transport configuration is required either in plugin config or Payload config')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user