liara_delete_mail_server
Remove a mail server from the Liara cloud platform by specifying its unique ID to manage your email infrastructure.
Instructions
Delete a mail server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailId | Yes | The mail server ID to delete |
Implementation Reference
- src/services/mail.ts:91-98 (handler)The main handler function that implements the logic to delete a mail server. It validates the mail server ID, creates a specialized mail client, and sends a DELETE request to the Liara Mail API endpoint `/v1/mails/{mailId}`.export async function deleteMailServer( client: LiaraClient, mailId: string ): Promise<void> { validateRequired(mailId, 'Mail server ID'); const mailClient = createMailClient(client); await mailClient.delete(`/v1/mails/${mailId}`); }
- src/services/mail.ts:13-30 (helper)Helper function that creates a specialized LiaraClient for the Mail service API with the correct baseURL 'https://mail-service.liara.ir/api'.function createMailClient(client: LiaraClient): LiaraClient { // Access the internal client to get the API token const internalClient = (client as any).client; const apiToken = internalClient?.defaults?.headers?.Authorization?.replace('Bearer ', '') || process.env.LIARA_API_TOKEN; const teamId = (client as any).teamId || process.env.LIARA_TEAM_ID; if (!apiToken) { throw new Error('API token is required for Mail operations'); } // Create new client with Mail service base URL return new LiaraClient({ apiToken, teamId, baseURL: 'https://mail-service.liara.ir/api', }); }
- src/api/types.ts:287-293 (schema)Type definition for MailServer used across mail operations, including potentially for listing or getting before deletion.export interface MailServer { _id: string; name: string; mode: 'DEV' | 'LIVE'; status: 'ACTIVE' | 'INACTIVE'; createdAt: string; }