Merge pull request #12 from xtr-dev/dev

Make mailer transport config optional, use Payload config fallback
This commit is contained in:
Bas
2025-09-13 16:04:26 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@xtr-dev/payload-mailing", "name": "@xtr-dev/payload-mailing",
"version": "0.0.4", "version": "0.0.5",
"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",

View File

@@ -40,8 +40,11 @@ export class MailingService implements IMailingService {
} else { } else {
this.transporter = nodemailer.createTransport(this.config.transport as MailingTransportConfig) this.transporter = nodemailer.createTransport(this.config.transport as MailingTransportConfig)
} }
} else if (this.payload.email && 'sendMail' in this.payload.email) {
// Use Payload's configured mailer
this.transporter = this.payload.email
} else { } else {
throw new Error('Email transport configuration is required') throw new Error('Email transport configuration is required either in plugin config or Payload config')
} }
} }