Ir a la documentación
Python

openemail.settings

Cada método de este espacio de nombres: su firma, sus parámetros, lo que devuelve y un ejemplo.

Métodos

Mailbox preferences such as timezone and language, and the signature and tracking of each address.

settings.get()

Read the workspace settings

Alcancessettings:read
Firma
def get(    *,    address: str | None = None,    api_key: str | None = None,    timeout: float | None = None,) -> SettingsResource

Returns every setting with defaults filled in, so a field that was never saved still has a value and reading one never depends on which release introduced it. SettingsResource is a plain dict[str, Any]: it holds address, signature, openEmailSignature, timezone, language, defaultEmailAlias, trackOpens and trackClicks, and every other stored setting under its own key, such as timeFormat, weekStart, undoSendEnabled, blockedSenders and blockedDomains.

signature, openEmailSignature, trackOpens and trackClicks belong to each address. There is no value for them across the workspace or the account. Pass address= to read them the way a send from that address resolves them: the address's own values, then its domain's catch-all when the catch-all caught that address rather than it being one you created, then the built-in defaults. A plus address with no settings of its own reads its base address's. Without address= the four read as the built-in defaults: no signature, the OpenEmail footer on, and open and link tracking off. address on the result is the address the four were resolved for, lowercased, or None.

Every other field is the workspace's and reads the same with or without address=: the workspace owner's account settings with the workspace's own overrides applied on top, whoever created the key. The privacy fields (externalImages, trustedSenders, blockedSenders, blockedDomains, blockedWords and useDefaultBlockedWords) no longer live on an account at all: a workspace holds them, a domain can answer differently, and one address can answer differently again in the app.

signature is the HTML added to mail sent from the address, and openEmailSignature adds the OpenEmail footer only while signature is empty. trackOpens and trackClicks apply to a send from the address whose tracking does not set them itself.

Parámetros

addressstr

An address, or *@domain for the catch-all of a domain, to resolve signature, openEmailSignature, trackOpens and trackClicks for. A key narrowed to particular addresses or domains may name only an address it holds, and a catch-all only on a domain it holds whole, or the call is a 422 capability_unsupported.

api_keystr

Overrides the client's API key for this call only.

timeoutfloat

Seconds this call may take, the response included, before it raises OpenEmailNetworkError with is_timeout. It overrides the client's timeout for this call, and 0 turns the limit off.

Devuelve

SettingsResource, a dict with 'object': 'settings', the eight fields above and every other stored setting as further keys.

Ejemplo

from openemail import openemail workspace = openemail.settings.get() print(workspace.get('timezone'), workspace.get('language')) sales = openemail.settings.get(address='[email protected]') print(sales.get('signature'), sales.get('trackOpens'), sales.get('trackClicks'))

Notas

  • A stored signature longer than 150,000 characters reads back as an empty string instead of failing the request.

  • defaultEmailAlias only preselects the From address in the app composer. The API never uses it to choose a sender.

También disponible en

API
GET /settings
TypeScript
settings.get()
Ruby
settings.get
CLI
openemail settings get

settings.update()

Change workspace settings

Alcancessettings:write
Firma
def update(    patch: SettingsPatch,    *,    address: str | None = None,    api_key: str | None = None,    timeout: float | None = None,) -> SettingsResource

A partial update: fields you send are validated and saved, fields you leave out keep their values, and the response is the full settings dict read back after the write, in the same shape get returns.

Without address= it changes the workspace's settings. signature, openEmailSignature, trackOpens and trackClicks are refused there with a 422 address_required naming the field, because they are set on each address and there is no value for them across the workspace or the account, and nothing is written. The privacy fields (externalImages, trustedSenders, blockedSenders, blockedDomains, blockedWords, useDefaultBlockedWords) are written to the workspace's own overrides, and the rest to the workspace owner's account settings. The response applies the workspace's overrides, so when the workspace overrides a field you changed, the response keeps showing the override and your value only takes effect once that override is gone. Keys the settings schema does not know are dropped silently rather than refused, and a known key with the wrong type is a 422 invalid_parameter naming it.

With address= the patch may carry those four fields only, and any other field is a 422 not_per_address naming it. The address has to be one in this workspace, or *@domain for a verified domain here with its catch-all on, or the call is a 422 invalid_parameter on address. The values are saved on that address alone and the response is what get(address=...) returns for it. A catch-all's values apply to the addresses its domain catches, and a new address created on that domain starts with a copy of them and changes on its own from then on.

signature is HTML added to mail sent from the address, and is sanitised on write, so the value you get back is what will actually be sent. More than 150,000 characters is a 422 signature_too_long, checked before sanitising and again after it. Mail sent through this API carries it only when the send sets 'signature': True, and template sends and encrypted sends never do.

Parámetros

patch['signature']str

HTML signature of the address named by address=, at most 150,000 characters, sanitised on write. An empty string removes it. Only with address=.

patch['openEmailSignature']bool

Adds the OpenEmail footer to mail from the address while its signature is empty. On by default. Only with address=.

patch['timezone']str

IANA zone name, saved as given without checking it.

patch['language']str

Language code such as en, saved as given without checking it.

patch['defaultEmailAlias']str

Address the app composer preselects as From.

patch['trackOpens']bool

Open tracking on mail from the address, for sends whose tracking does not set opens. Off by default. Only with address=.

patch['trackClicks']bool

Link tracking on mail from the address, for sends whose tracking does not set clicks. Off by default. Only with address=.

addressstr

The address, or *@domain for the catch-all of a domain, whose signature, openEmailSignature, trackOpens and trackClicks the patch sets. A key narrowed to particular addresses or domains may name only an address it holds, and a catch-all only on a domain it holds whole, or the call is a 422 capability_unsupported.

api_keystr

Overrides the client's API key for this call only.

timeoutfloat

Seconds this call may take, the response included, before it raises OpenEmailNetworkError with is_timeout. It overrides the client's timeout for this call, and 0 turns the limit off.

Devuelve

SettingsResource, the full saved settings with workspace overrides applied, in the same shape as get with the same address=.

Ejemplo

from openemail import openemail openemail.settings.update({'timezone': 'Europe/London'}) saved = openemail.settings.update(    {        'signature': '<p>Ada Lovelace<br>Analytical Engines Ltd</p>',        'trackClicks': False,    },    address='[email protected]',) print(saved.get('address'), saved.get('signature'), saved.get('trackClicks'))

Notas

  • The SDK retries this call after a network failure or a retryable status, which is safe because the same patch saves the same values.

  • An empty dict is accepted, changes nothing and returns the current settings.

  • A misspelt zone or language code is saved rather than refused, so check it before sending, for example with zoneinfo.ZoneInfo and resolve_language.

También disponible en

API
PATCH /settings
TypeScript
settings.update()
Ruby
settings.update
CLI
openemail settings update