import { SentlyError } from "../core/errors.js"; import type { MailOptions, SendResult, SMTPConfig, Transport, VerifyResult } from "../core/types.js"; /** Hostinger SMTP hostname. */ export declare const HOSTINGER_SMTP_HOST = "smtp.hostinger.com"; /** SSL/TLS-on-connect submission port (default for {@link HostingerTransport} SMTP). */ export declare const HOSTINGER_SMTP_PORT_SSL = 465; /** STARTTLS submission port. */ export declare const HOSTINGER_SMTP_PORT_STARTTLS = 587; /** Default Hostinger Mail API base URL. */ export declare const HOSTINGER_API_BASE_URL = "https://api.mail.hostinger.com"; /** Hostinger Mail API configuration. */ export interface HostingerConfig { /** API token from hPanel → Emails → Agentic Mail → API access (shown once at creation). */ token: string; /** Resource ID of the managed mailbox to send from (e.g. `"AC1a2b3c4d5e6f7g"`). */ mailbox: string; /** API base URL. Default: {@link HOSTINGER_API_BASE_URL}. */ baseUrl?: string; } /** * Ready SMTP options for Hostinger Email. * Pass `HostingerTransport({ user, pass })` to `createSMTPMailer`. */ export interface HostingerSmtpOptions { /** Full mailbox address — this is the SMTP username. */ user: string; /** Mailbox password from hPanel → Emails → Configuration settings. */ pass: string; /** * Submission port. * - `465` — SSL/TLS on connect (default) * - `587` — STARTTLS */ port?: 465 | 587; /** Enable the SMTP connection pool. Default: `false`. */ pool?: boolean; /** Max simultaneous SMTP connections when `pool` is true. Default: `5`. */ maxConnections?: number; } /** A mailbox the API token can manage, as returned by {@link HostingerTransport.listMailboxes}. */ export interface HostingerMailbox { /** Mailbox resource ID — pass it as {@link HostingerConfig.mailbox}. */ resourceId: string; /** Email address of the mailbox. */ address: string; } /** * Reference to a source message by IMAP UID within a folder. * Used by {@link HostingerTransport.sendReply} and {@link HostingerTransport.sendForward}. */ export interface HostingerMessageRef { /** Folder containing the source message (e.g. `"INBOX"`). */ folder: string; /** IMAP UID of the source message. */ uid: number; } /** * Build a ready {@link SMTPConfig} for Hostinger Email. * * Defaults to port `465` with `secure: true`. Hostinger supports `465` and * `587` only — not `2525`. Prefer `HostingerTransport({ user, pass })`; this * alias stays for 1.x compatibility. */ export declare function hostingerSmtpConfig(options: HostingerSmtpOptions): SMTPConfig; /** Error thrown when the Hostinger Mail API returns a non-success response. */ export declare class HostingerError extends SentlyError { readonly statusCode: number; readonly apiError: unknown; /** Creates a Hostinger Mail API error with status code and response payload. */ constructor(message: string, statusCode: number, apiError: unknown); } /** * Hostinger Mail API transport instance type (`new` / call with API config). * Constructed by the {@link HostingerTransport} overload — not exported directly. */ declare class HostingerTransportImpl implements Transport { readonly provider = "hostinger"; /** Hostinger Mail API token for Bearer authentication. */ private readonly token; /** Resource ID of the managed mailbox to send from. */ private readonly mailbox; /** Hostinger Mail API base URL. */ private readonly baseUrl; /** Creates a Hostinger transport with the given API token and mailbox. */ constructor(config: HostingerConfig); /** List the mailboxes this token can manage — use it to discover your mailbox resource ID. */ listMailboxes(): Promise; /** Build the JSON body for a single Hostinger email. */ private buildEmailBody; /** Map a 204 No Content success to a normalized SendResult. */ private toSendResult; /** POST the send body and map the response. */ private postSend; /** Sends an email via the Hostinger Mail API. */ send(options: MailOptions): Promise; /** * Reply to a mailbox message. * Copies Message-Id / References into In-Reply-To / References and flags the * source `\Answered`. Mutually exclusive with {@link sendForward}. */ sendReply(options: MailOptions, inReplyTo: HostingerMessageRef): Promise; /** * Forward a mailbox message. * Copies Message-Id / References into In-Reply-To / References and flags the * source `$forwarded`. Mutually exclusive with {@link sendReply}. */ sendForward(options: MailOptions, forwardOf: HostingerMessageRef): Promise; /** Verifies the API token and that the configured mailbox is in its scope. */ verify(): Promise; } /** * Hostinger Mail API transport instance (returned by {@link HostingerTransport} * overloads for `{ token, mailbox }` config). */ export type HostingerMailTransport = HostingerTransportImpl; /** * Function-overloaded constructor for `HostingerTransport`: * - `new` / call with {@link HostingerConfig} → {@link HostingerMailTransport} * - call with {@link HostingerSmtpOptions} → {@link SMTPConfig} */ export interface HostingerTransportOverloads { new (config: HostingerConfig): HostingerMailTransport; (config: HostingerConfig): HostingerMailTransport; (config: HostingerSmtpOptions): SMTPConfig; } /** * Hostinger email — one name, two shapes (function overloading). * * - **Mail API** — `new HostingerTransport({ token, mailbox })` (or the same * call without `new`) → a `Transport` for `createMailer`. * - **SMTP** — `HostingerTransport({ user, pass })` → a ready `SMTPConfig` * for `createSMTPMailer`. * * IntelliSense narrows options and the return type by the config shape. */ export declare const HostingerTransport: HostingerTransportOverloads; export {};