Skip to Content

Forward all mail to a destination.

Points forward-everything at a verified destination, and resumes it if it was paused. Junk, bounce and daemon mail are never forwarded.

openemail.forwarding.setForwardAll(
  mailboxId: string,
  body: ForwardingSetForwardAllBody,
  options?: CallOptions,
): ApiPromise<Forwarding>

It calls PUT /mailboxes/{mailboxId}/forwarding/all: Forward all mail to a destination in the API reference.

Example

const forwarding = await openemail.forwarding.setForwardAll(mailboxId, { destinationId: '…' })

Arguments

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

Options

It takes no options of its own. 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, Forwarding. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.

Errors

StatusWhat it means
400validation_failed; or destination_is_self / destination_loops / destination_chain_too_long when the destination now routes back to this mailbox; or destination_not_permitted when the account's allowlist no longer permits it; or destination_fans_out when its address now resolves to something we host that reaches more than one party. All five are re-checked here because this is the write that arms the forward, and a route proved as a single mailbox may have been retargeted to a group since; or destination_unverified (carrying the address as target) when the destination has not proved a code, or its proof was revoked. A destination_loops found only while the forward is published (a loop closed after the check above) also carries forwardAll, the setting as it now stands: the refused write cleared the forward it replaced, so it reads off
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
404Mailbox or destination not found, or not accessible to this principal
409inbound_edge_cap — the destination already receives the most forwards an address may. Carries forwardAll, the setting as it now stands: the refused write cleared the forward it replaced, so it reads off
413too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing
503temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

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

ForwardingSetForwardAllBody

/** The body of `forwarding.setForwardAll`. */
type ForwardingSetForwardAllBody = {
  /** A verified destination to receive a copy of all mail */
  destinationId: string
}

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