UNPKG

@visulima/email

Version:

A comprehensive email library with multi-provider support, crypto utilities, and template engines

59 lines (58 loc) 2.58 kB
import type { Attachment } from "../../types.d.ts"; /** * Processes attachment content and converts it to a base64-encoded string. * @param attachment The attachment object to process. * @param providerName The name of the provider (for error messages). * @returns The base64-encoded string representation of the attachment content. * @throws {EmailError} When the attachment has no content. */ export declare const processAttachmentContent: (attachment: Attachment, providerName: string) => Promise<string>; /** * Creates a standardized attachment object for API payloads. * @param attachment The attachment object to standardize. * @param providerName The name of the provider (for error messages). * @returns A standardized attachment object with content, contentType, disposition, filename, and optional contentId. */ export declare const createStandardAttachment: (attachment: Attachment, providerName: string) => Promise<{ content: string; contentId?: string; contentType: string; disposition: string; filename: string; }>; /** * Creates a SendGrid-specific attachment format. * @param attachment The attachment object to format. * @param providerName The name of the provider (for error messages). * @returns A SendGrid-formatted attachment object with content, type, disposition, filename, and optional content_id. */ export declare const createSendGridAttachment: (attachment: Attachment, providerName: string) => Promise<{ content: string; content_id?: string; disposition: string; filename: string; type: string; }>; /** * Creates a Postmark-specific attachment format. * @param attachment The attachment object to format. * @param providerName The name of the provider (for error messages). * @returns A Postmark-formatted attachment object with Content, ContentType, Name, and optional ContentID. */ export declare const createPostmarkAttachment: (attachment: Attachment, providerName: string) => Promise<{ Content: string; ContentID?: string; ContentType: string; Name: string; }>; /** * Creates a Mailgun-specific attachment format for form data. * @param attachment The attachment object to format. * @param providerName The name of the provider (for error messages). * @param index The index of the attachment in the attachments array. * @returns A Mailgun-formatted attachment object with content and key properties. */ export declare const createMailgunAttachment: (attachment: Attachment, providerName: string, index: number) => Promise<{ content: string; key: string; }>;