mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
Add beforeSend hook for email customization
- Add BeforeSendHook type and BeforeSendMailOptions interface - Implement hook execution in MailingService before sending emails - Hook allows adding attachments, headers, and modifying email options - Add comprehensive documentation with examples - Bump version to 0.1.20
This commit is contained in:
@@ -48,6 +48,21 @@ export type TemplateRendererHook = (template: string, variables: Record<string,
|
||||
|
||||
export type TemplateEngine = 'liquidjs' | 'mustache' | 'simple'
|
||||
|
||||
export interface BeforeSendMailOptions {
|
||||
from: string
|
||||
to: string[]
|
||||
cc?: string[]
|
||||
bcc?: string[]
|
||||
replyTo?: string
|
||||
subject: string
|
||||
html: string
|
||||
text?: string
|
||||
attachments?: any[]
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export type BeforeSendHook = (options: BeforeSendMailOptions, email: BaseEmailDocument) => BeforeSendMailOptions | Promise<BeforeSendMailOptions>
|
||||
|
||||
export interface MailingPluginConfig {
|
||||
collections?: {
|
||||
templates?: string | Partial<CollectionConfig>
|
||||
@@ -62,6 +77,7 @@ export interface MailingPluginConfig {
|
||||
templateRenderer?: TemplateRendererHook
|
||||
templateEngine?: TemplateEngine
|
||||
richTextEditor?: RichTextField['editor']
|
||||
beforeSend?: BeforeSendHook
|
||||
onReady?: (payload: any) => Promise<void>
|
||||
initOrder?: 'before' | 'after'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user