UNPKG

@xtr-dev/payload-mailing

Version:

Template-based email system with scheduling and job processing for PayloadCMS

35 lines 1.02 kB
import { Payload } from 'payload'; import { BaseEmailDocument } from './types/index.js'; export interface SendEmailOptions<T extends BaseEmailDocument = BaseEmailDocument> { template?: { slug: string; variables?: Record<string, any>; }; data?: Partial<T>; collectionSlug?: string; processImmediately?: boolean; queue?: string; } /** * Send an email with full type safety * * @example * ```typescript * // With your generated Email type * import { Email } from './payload-types' * * const email = await sendEmail<Email>(payload, { * template: { * slug: 'welcome', * variables: { name: 'John' } * }, * data: { * to: 'user@example.com', * customField: 'value' // Your custom fields are type-safe! * } * }) * ``` */ export declare const sendEmail: <TEmail extends BaseEmailDocument = BaseEmailDocument>(payload: Payload, options: SendEmailOptions<TEmail>) => Promise<TEmail>; export default sendEmail; //# sourceMappingURL=sendEmail.d.ts.map