Skip to Content

Update out-of-office auto-reply settings.

Configures or replaces the out-of-office auto-responder settings. Supports optimistic locking via the If-Match header with the state token.

openemail.vacation.set(
  mailboxId: string,
  body: VacationSetBody,
  options?: VacationSetOptions,
): ApiPromise<Vacation>

It calls PUT /mailboxes/{mailboxId}/vacation: Update out-of-office auto-reply settings in the API reference.

Example

const vacation = await openemail.vacation.set(mailboxId, { isEnabled: true })

Arguments

ArgumentTypeDescription
mailboxIdstringMailbox ULID identifier. The path's {mailboxId}.
bodyVacationSetBodyThe request's body.

Options

The last argument, options, a VacationSetOptions, takes:

OptionTypeSent asDescription
ifMatchstringheader if-matchExpected state token for optimistic locking (omit for unconditional update)

Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).

Answer

Awaited, it is the API's JSON, Vacation. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
400validation_failed — invalid request body
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
404Mailbox not found or not accessible to this principal
412state_conflict — state token does not match current version
413too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing
422invalid_window (fromDate must be before toDate) or empty_body
503temporary_failure: the mailbox or account is in transition while its store is being adopted; retry after Retry-After

A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.

Types

VacationSetBody

/** The body of `vacation.set`. */
type VacationSetBody = {
  /** @default null */
  fromDate?: string | null
  /** @default null */
  htmlBody?: string | null
  isEnabled: boolean
  /** @default null */
  subject?: string | null
  /** @default null */
  textBody?: string | null
  /** @default null */
  toDate?: string | null
}

It names these types of the API, each on a page of its own: Vacation.