commands/create.ts

imapflow · src/commands/create.ts · typescript · MIT
email

Creates an IMAP mailbox and auto‑subscribes it for a given connection.

// Source: https://github.com/postalsys/imapflow | License: MIT | Copyright 2020-2024 Postal Systems OÜ
// Provided via justclaw.it.com; keep this notice with the code.
import { encodePath, normalizePath, getStatusCode, isAuthenticatedState, reportCommandError } from '../tools.js';
import type { ImapFlow, ExecResponse } from '../imap-flow.js';
import type { ImapAttribute } from '../handler/types.js';
import type { MailboxCreateResponse } from '../types.js';

/**
 * Creates a new mailbox and subscribes to it.
 *
 * @param connection - IMAP connection instance
 * @param path - Mailbox path to create
 * @returns Object with path and creation status, or undefined if preconditions not met
 * @throws If the CREATE command fails (except when mailbox already exists)
 */
export default async functi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key