UNPKG

eml-generator

Version:

Generate EML (email) files from JSON data in Node.js and browsers

43 lines (42 loc) 978 B
declare global { interface Window { Buffer: typeof Buffer; } } type BufferLike = Buffer | Uint8Array; /** * Interface for email address object */ interface EmailAddress { name?: string; email?: string; } /** * Interface for attachment object */ interface Attachment { filename?: string; name?: string; contentType?: string; inline?: boolean; cid?: string; data: string | BufferLike; } /** * Interface for the main EML generator options */ interface EmlOptions { headers?: Record<string, string | string[]>; subject?: string; from?: string | EmailAddress | EmailAddress[]; to: string | EmailAddress | EmailAddress[]; cc?: string | EmailAddress | EmailAddress[]; text?: string; html?: string; attachments?: Attachment[]; } /** * Generates an EML file content string from structured data. */ export declare function eml(data?: Partial<EmlOptions> & Pick<EmlOptions, 'to'>): string; export {};