UNPKG

@454creative/easy-email

Version:

A framework-agnostic email service library for Node.js with observability and monitoring

107 lines 2.26 kB
/** * Interface for email recipient */ export interface EmailRecipient { email: string; name?: string; } /** * Interface for email attachment */ export interface EmailAttachment { filename: string; content: string | Buffer; contentType?: string; encoding?: string; path?: string; } /** * Interface for email options */ export interface EmailOptions { from: EmailRecipient; to: EmailRecipient | EmailRecipient[]; cc?: EmailRecipient | EmailRecipient[]; bcc?: EmailRecipient | EmailRecipient[]; subject: string; text?: string; html?: string; attachments?: EmailAttachment[]; replyTo?: string; headers?: Record<string, string>; template?: string; context?: Record<string, any>; } /** * Interface for email response */ export interface EmailResponse { success: boolean; messageId?: string; error?: { message: string; code?: string; provider?: EmailProviderType; details?: { rejected?: string[]; accepted?: string[]; smtpResponse?: string; sendgridResponse?: any; sesResponse?: any; }; }; } /** * Interface for SMTP configuration */ export interface SmtpConfig { host: string; port: number; secure?: boolean; auth?: { user: string; pass: string; }; tls?: { rejectUnauthorized?: boolean; }; } /** * Interface for SendGrid configuration */ export interface SendGridConfig { apiKey: string; } /** * Interface for AWS SES configuration */ export interface SesConfig { region: string; accessKeyId?: string; secretAccessKey?: string; sessionToken?: string; credentials?: any; endpoint?: string; apiVersion?: string; maxRetries?: number; httpOptions?: { timeout?: number; connectTimeout?: number; }; } /** * Email provider type */ export declare enum EmailProviderType { SMTP = "smtp", SENDGRID = "sendgrid", SES = "ses" } /** * Email provider configuration */ export interface EmailProviderConfig { type: EmailProviderType; config: SmtpConfig | SendGridConfig | SesConfig; } //# sourceMappingURL=email-options.interface.d.ts.map