import * as plugins from '../plugins.js'; import type * as authInterfaces from '../data/auth.js'; import type { ISmtpAccountInfo, ISmtpAccountMailPolicy, ISmtpAccountRecipientScope, ISmtpAccountSenderScope } from '../data/smtp-account.js'; /** * Shared mutation result. `warnings` carries non-blocking findings such as * sender domains that are not managed email domains (warn-and-allow). */ export interface ISmtpAccountActionResult { success: boolean; message?: string; code?: string; warnings?: string[]; } /** * List all SMTP submission accounts (never includes credentials). */ export interface IReq_GetSmtpAccounts extends plugins.typedrequestInterfaces.implementsTR { method: 'getSmtpAccounts'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; }; response: { accounts: ISmtpAccountInfo[]; }; } /** * Create an SMTP submission account. The password is machine-generated and * returned exactly once in this response; only a SCRAM verifier is persisted. */ export interface IReq_CreateSmtpAccount extends plugins.typedrequestInterfaces.implementsTR { method: 'createSmtpAccount'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; username: string; description?: string; senderScope?: ISmtpAccountSenderScope; recipientScope?: ISmtpAccountRecipientScope; mailPolicy?: ISmtpAccountMailPolicy; }; response: ISmtpAccountActionResult & { account?: ISmtpAccountInfo; /** Shown once; never retrievable again. */ password?: string; }; } /** * Update an SMTP account's description, scopes, or mail policy. */ export interface IReq_UpdateSmtpAccount extends plugins.typedrequestInterfaces.implementsTR { method: 'updateSmtpAccount'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; id: string; description?: string; senderScope?: ISmtpAccountSenderScope; recipientScope?: ISmtpAccountRecipientScope; mailPolicy?: ISmtpAccountMailPolicy; }; response: ISmtpAccountActionResult & { account?: ISmtpAccountInfo; }; } /** * Enable or disable an SMTP account. Disabled accounts always fail * authentication (and still shadow same-named legacy static users). */ export interface IReq_ToggleSmtpAccount extends plugins.typedrequestInterfaces.implementsTR { method: 'toggleSmtpAccount'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; id: string; enabled: boolean; }; response: ISmtpAccountActionResult & { account?: ISmtpAccountInfo; }; } /** * Rotate an SMTP account's password. The new password is returned exactly * once; the previous credential stops working immediately. */ export interface IReq_RotateSmtpAccountPassword extends plugins.typedrequestInterfaces.implementsTR { method: 'rotateSmtpAccountPassword'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; id: string; }; response: ISmtpAccountActionResult & { account?: ISmtpAccountInfo; /** Shown once; never retrievable again. */ password?: string; }; } /** * Delete an SMTP account. */ export interface IReq_DeleteSmtpAccount extends plugins.typedrequestInterfaces.implementsTR { method: 'deleteSmtpAccount'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; id: string; }; response: ISmtpAccountActionResult; } /** * Remove a named legacy route from the persisted email server settings * (EmailServerSettingsDoc.emailConfig.routes) — the retirement lever for * legacy internal-relay routes once scoped SMTP accounts replace them. * Applies through the standard email settings restart path. */ export interface IReq_RemoveLegacyEmailRoute extends plugins.typedrequestInterfaces.implementsTR { method: 'removeLegacyEmailRoute'; request: { identity?: authInterfaces.IIdentity; apiToken?: string; routeName: string; }; response: ISmtpAccountActionResult; }