/**
 * Assemble an RFC 5322 / MIME message. The ONE place that does this.
 *
 * Why it exists: four live code paths built messages by hand — desktop send
 * and draft (`mailx-service`), Android/web send and draft (`mailx-store-web`)
 * — 72% identical line-for-line, plus four more copies in packages nothing
 * could reach. Every fix to the shape had to be found and applied N times,
 * and the N-th was routinely missed:
 *
 *   - v1.2.166  envelope scraped quoted headers — "SAME shape in 3 files"
 *   - v1.2.179  inline images data: → cid: — had to land in BOTH send paths
 *   - v1.2.226  RFC 2047 encoded-words — 7 sites by hand, and the Android
 *               path still got only Subject: its From/To/Cc/Bcc were raw
 *               interpolation until this unification (2026-08-09), so an
 *               accented display name sent from Android was still an EAI
 *               message that non-SMTPUTF8 receivers bounce
 *
 * The shape produced is unchanged from what desktop send has emitted since
 * v1.2.179 — this is an extraction, verified byte-for-byte against the old
 * code over a matrix of body/attachment/inline-image/header combinations
 * (see `test/mime-build.test.mjs`), not a rewrite.
 *
 * Structure it emits, narrowest form that carries the content:
 *
 *   text only ............... text/plain
 *   html .................... multipart/alternative (plain derived + html)
 *   html + pasted images .... multipart/related [ alternative, image parts ]
 *   any of those + files .... multipart/mixed [ the above, attachments ]
 *   draft (simpleHtml) ...... a single text/html part, no alternative
 */
export interface MimeAttachment {
    filename?: string;
    mimeType?: string;
    dataBase64?: string;
}
export interface BuildMimeOptions {
    /** Already-formatted address strings ("Name <a@b>", comma-separated). */
    from: string;
    to?: string;
    cc?: string;
    bcc?: string;
    subject: string;
    bodyHtml?: string;
    bodyText?: string;
    attachments?: MimeAttachment[];
    inReplyTo?: string;
    references?: string[];
    /** Supply to reuse an existing id; omit and one is generated from `domain`. */
    messageId?: string;
    /** Domain for the generated Message-ID and for inline-image cid: ids. */
    domain: string;
    /** Extra header lines inserted before MIME-Version (e.g. X-Mailx-Draft-ID). */
    extraHeaders?: string[];
    /** Emit no Message-ID header at all — the draft paths never carried one. */
    omitMessageId?: boolean;
    /** Draft mode: one text/html part, no alternative / related / mixed and no
     *  inline-image extraction. A draft is re-parsed by the compose window, not
     *  delivered, so the multipart machinery would only get in the way. */
    simpleHtml?: boolean;
    /** Injectable for tests; defaults to `new Date()`. */
    now?: Date;
    /** Injectable for tests so boundaries and ids are reproducible. */
    unique?: () => string;
}
export interface BuiltMime {
    /** The complete message, CRLF line endings, ready for SMTP or APPEND. */
    raw: string;
    /** The Message-ID actually used (empty when `omitMessageId`). */
    messageId: string;
    /** How many data: images became cid: parts — worth logging. */
    inlineImageCount: number;
}
export declare function buildMimeMessage(opts: BuildMimeOptions): BuiltMime;
//# sourceMappingURL=mime-build.d.ts.map