/** * MIME/multipart header helpers shared across email connectors (Mailgun's * multipart body, mailbox/encoded-word formatting for SES, Resend, Postmark * and Mailgun). Attacker-influenced attachment `contentType`/`filename` * values must never be able to inject or override MIME/multipart part headers * via embedded CR/LF. */ /** * Strip CR/LF characters from a header value to prevent header injection. * MIME header field bodies cannot contain bare CR/LF; any caller-supplied * value that does is sanitised to spaces. */ export declare function stripCrlf(value: string): string; /** * Sanitize a MIME/multipart filename WITHOUT adding surrounding quotes: strips * CR/LF then backslash-escapes embedded `"`/`\`. For templates that already * supply the surrounding `"..."` (e.g. Mailgun `filename="${...}"`). Use * `quoteMimeFilename` when the surrounding quotes are not already present. */ export declare function escapeMimeFilename(name: string): string; /** * Quote a MIME filename that may contain `"` or other special characters per * RFC 2183. Bare filenames are quoted; embedded `"` is backslash-escaped. */ export declare function quoteMimeFilename(name: string): string; /** * Format an RFC 5322 mailbox (`display-name `) for vendors that * take `From` as one string (SES `FromEmailAddress`, Resend, Postmark, * Mailgun). * * - An atext-only name is sent as-is (`Acme Mail `). * - An ASCII name containing specials (`, . " ( ) < > @ : ; [ ] \`) must be a * quoted-string, or `Doe, Jane` would parse as two mailboxes. * - A non-ASCII name becomes RFC 2047 encoded-words and is NOT quoted: RFC * 2047 §5 says "An 'encoded-word' MUST NOT appear within a * 'quoted-string'". SES's developer guide requires this form for a Unicode * "friendly from" name. */ export declare function formatMailbox(name: string | undefined, addr: string): string; /** * RFC 2047 base64 encoded-words for a header value. ASCII input is returned * unchanged. RFC 2047 §2: "An 'encoded-word' may not be more than 75 * characters long", so the UTF-8 bytes are split — only on character * boundaries — into 45-byte runs (60 base64 chars + 12 for `=?UTF-8?B?…?=`) * and the words are joined with a space, which decoders drop between * adjacent encoded-words. */ export declare function encodeWords(value: string): string;