/** * Gmail helpers — MIME building, header extraction, encoding utilities. */ import type { gmail_v1 } from '@googleapis/gmail'; import type { GmailMessage, AttachmentInfo, SendOptions, BufferAttachment } from './types.js'; /** * Extract a header value from a Gmail message payload. */ export declare function getHeader(headers: gmail_v1.Schema$MessagePartHeader[] | undefined, name: string): string; /** * Parse address lists like "a@b.com, c@d.com" into arrays. */ export declare function parseAddressList(value: string): string[]; /** * Extract attachments metadata from a message payload. */ export declare function extractAttachments(payload: gmail_v1.Schema$MessagePart | undefined): AttachmentInfo[]; /** * Extract body text and HTML from a message payload. */ export declare function extractBody(payload: gmail_v1.Schema$MessagePart | undefined): { text?: string; html?: string; }; /** * Decode base64url-encoded string (as used by Gmail API). */ export declare function base64Decode(data: string): string; /** * Encode string to base64url (for Gmail API raw messages). */ export declare function base64UrlEncode(data: string | Buffer): string; /** * RFC 2047 encode a header value if it contains non-ASCII characters. * Uses Base64 encoding: =?UTF-8?B??= * * Returns the value unchanged if it's pure ASCII. */ export declare function rfc2047Encode(value: string): string; /** * RFC 2047 encode the display name portion of a single email address. * "Júlia Fargas " → "=?UTF-8?B?...?= " * Plain addresses like "julia@example.com" are returned unchanged. */ export declare function rfc2047EncodeAddress(address: string): string; /** * RFC 2047 encode a comma-separated list of email addresses. * Each display name is encoded individually if it contains non-ASCII chars. */ export declare function rfc2047EncodeAddressList(addresses: string): string; /** * Parse a raw Gmail API message into our GmailMessage shape. */ export declare function parseMessage(raw: gmail_v1.Schema$Message): GmailMessage; /** * Build a MIME message string from SendOptions. * Supports plain text, HTML multipart, and file attachments. */ export declare function buildMimeMessage(from: string, opts: SendOptions, extraHeaders?: Record): Promise; /** * Build a MIME message for forwarding, with in-memory Buffer attachments. * * Similar to buildMimeMessage but accepts BufferAttachment[] instead of file paths. * Builds the forwarded body with quoted original content. */ export declare function buildForwardMime(from: string, to: string, subject: string, userBody: string | undefined, originalBody: { text?: string; html?: string; }, bufferAttachments: BufferAttachment[], extraHeaders?: Record, userHtml?: string): Promise; //# sourceMappingURL=helpers.d.ts.map