mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 00:03:23 +00:00
Merge pull request #12 from xtr-dev/dev
Make mailer transport config optional, use Payload config fallback
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
@@ -40,8 +40,11 @@ export class MailingService implements IMailingService {
|
||||
} else {
|
||||
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 {
|
||||
throw new Error('Email transport configuration is required')
|
||||
throw new Error('Email transport configuration is required either in plugin config or Payload config')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user