/** * Email Service supporting Resend API and Nodemailer SMTP * A generic, reusable email service for the app framework. * Resend is preferred when API key is configured. */ import { EventEmitter } from "events"; export interface EmailOptions { to: string | string[]; subject: string; text?: string; html?: string; attachments?: Array<{ filename: string; content?: string | Buffer; path?: string; }>; } export interface EmailConfig { enabled?: boolean; provider?: "resend" | "smtp"; resend?: { apiKey: string; }; smtp?: { host: string; port: number; secure?: boolean; auth?: { user: string; pass: string; }; }; from?: string; to?: string[]; appName?: string; appTitle?: string; logoUrl?: string; brandColor?: string; footerText?: string; footerLink?: string; } export type NotificationEventType = "startup" | "shutdown" | "error" | "warning" | "info" | "success" | "custom"; export interface NotificationEvent { type: NotificationEventType; title?: string; data: Record; timestamp: Date; } export interface EmailServiceStatus { enabled: boolean; provider: "Resend" | "SMTP" | "None"; recipients: string[]; } export declare class EmailService extends EventEmitter { private transporter?; private resend?; private enabled; private useResend; private notificationQueue; private processingInterval?; private fromAddress; private defaultRecipients; private config; private appName; private appTitle; private logoUrl?; private brandColor; private footerText?; private footerLink?; constructor(config?: EmailConfig); /** * Initialize the email service */ initialize(): Promise; /** * Update branding configuration */ setBranding(options: { appName?: string; appTitle?: string; logoUrl?: string; brandColor?: string; footerText?: string; footerLink?: string; }): void; /** * Send an email */ sendEmail(options: EmailOptions): Promise; /** * Queue a notification event */ queueNotification(event: NotificationEvent): void; /** * Send immediate notification (bypasses queue) */ sendImmediateNotification(event: NotificationEvent): Promise; /** * Send a notification with custom type and data */ notify(type: NotificationEventType, title: string, data: Record, immediate?: boolean): Promise; /** * Send startup notification */ notifyStartup(data?: Record): Promise; /** * Send error notification */ notifyError(errorMessage: string, details?: Record): Promise; /** * Send test email */ sendTestEmail(): Promise; /** * Get service status */ getStatus(): EmailServiceStatus; /** * Shutdown the service */ shutdown(): Promise; private startNotificationProcessor; private processNotificationQueue; private groupNotificationsByType; private sendNotificationEmail; private getNotificationSubject; private getNotificationIcon; private getAccentColor; private formatDateTime; private formatEventDataHtml; private formatNotificationHtml; private formatNotificationText; private formatEventDataText; private getNotificationTitle; private generateTestEmailHtml; } /** * Get the email service instance (singleton) */ export declare function getEmailService(): EmailService | null; /** * Create and initialize the email service */ export declare function createEmailService(config: EmailConfig): Promise; export default EmailService; //# sourceMappingURL=emailService.d.ts.map