/** * Email Send-With-Template API Route Handler for Next.js * * Sends an email rendered from a named template. * Re-export in your Next.js application at /api/email/send-with-template. * * @example * ```typescript * // app/api/email/send-with-template/route.ts * export { POST } from 'nextly/api/email-send-template'; * ``` * * The service returns `{ success, messageId? }`; the body surfaces both * fields plus the resolved template id alongside a server-authored toast * via `respondAction`. The attachment resolver throws `NextlyError` * directly (validation for caller-fixable failures, internal for storage * I/O); the machine-readable `EMAIL_ATTACHMENT_*` code lives at * `error.data.errors[0].code`. * * @module api/email-send-template */ /** * POST handler for sending an email using a template. * * Request body: * - `to` (string, required): Recipient email address * - `template` (string, required): Template slug * - `variables` (object, optional): Interpolation variables * - `cc` / `bcc` (string[], optional) * - `providerId` (string, optional) * - `attachments` (array, optional): `[{ mediaId, filename? }]` * * Response codes: * - 200 OK: `{ message, success, messageId?, templateId }` via `respondAction`. * - 400 Bad Request: invalid body / attachment count or size exceeded / mediaId not found. * - 401 Unauthorized. * - 500 Internal Server Error: storage read failed or provider error. */ declare const POST: (request: Request) => Promise; export { POST };