openemail.settings
इस नेमस्पेस का हर मेथड: उसका सिग्नेचर, उसके पैरामीटर, वह क्या लौटाता है और एक उदाहरण।
मेथड
Mailbox preferences such as timezone and language, and the signature and tracking of each address.
settings.get()
Read the workspace settings
get(options?: SettingsOptions): Promise<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 types address, signature, openEmailSignature, timezone, language, defaultEmailAlias, trackOpens and trackClicks, and the rest of the stored settings arrive as extra keys, 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 options.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 options.address the four read as the built-in defaults: no signature, the OpenEmail footer on, and open and link tracking on. address on the result is the address the four were resolved for, lowercased, or null.
Every other field is the workspace's and reads the same with or without options.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 that does not set tracking itself.
पैरामीटर
options.addressstringAn address, or
*@domainfor the catch-all of a domain, to resolvesignature,openEmailSignature,trackOpensandtrackClicksfor. 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 422capability_unsupported.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
लौटाता है
SettingsResource with object: 'settings', the eight typed fields and every other stored setting as additional keys.
उदाहरण
const settings = await openemail.settings.get() console.log(settings.timezone, settings.language) const sales = await openemail.settings.get({ address: '[email protected]' }) console.log(sales.signature, sales.trackOpens, sales.trackClicks)टिप्पणियाँ
A stored
signaturelonger than 150,000 characters reads back as an empty string instead of failing the request.defaultEmailAliasonly preselects the From address in the app composer. The API never uses it to choose a sender.
इनमें भी उपलब्ध
settings.update()
Change workspace settings
update(patch: SettingsPatch, options?: SettingsOptions): Promise<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 object read back after the write, in the same shape get returns.
Without options.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 options.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 get({ address }) 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.
पैरामीटर
patch.signaturestringHTML signature of the address named by
options.address, at most 150,000 characters, sanitised on write. An empty string removes it. Only withoptions.address.patch.openEmailSignaturebooleanAdds the OpenEmail footer to mail from the address while its
signatureis empty. On by default. Only withoptions.address.patch.timezonestringIANA zone name, saved as given without checking it.
patch.languagestringLanguage code such as
en, saved as given without checking it.patch.defaultEmailAliasstringAddress the app composer preselects as From.
patch.trackOpensbooleanOpen tracking on mail from the address, for sends that do not set
tracking.opens. Off by default. Only withoptions.address.patch.trackClicksbooleanLink tracking on mail from the address, for sends that do not set
tracking.clicks. Off by default. Only withoptions.address.options.addressstringThe address, or
*@domainfor the catch-all of a domain, whosesignature,openEmailSignature,trackOpensandtrackClicksthe 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 422capability_unsupported.options.signalAbortSignalCancels the request.
options.apiKeystringOverrides the client's API key for this call only.
लौटाता है
SettingsResource, the full saved settings with workspace overrides applied, in the same shape as get with the same options.address.
उदाहरण
await openemail.settings.update({ timezone: 'Europe/London' }) const saved = await openemail.settings.update( { signature: '<p>Ada Lovelace<br>Analytical Engines Ltd</p>', trackClicks: false }, { address: '[email protected]' }) console.log(saved.address, saved.signature, saved.trackClicks)टिप्पणियाँ
The SDK retries this call after a network failure, which is safe because the same patch saves the same values.
An empty object is accepted, changes nothing and returns the current settings.
A misspelt zone or language code is saved rather than refused, so validate it before sending.