Zur Dokumentation springen
PHP

$client->domains

Jede Methode in diesem Namespace: ihre Signatur, ihre Parameter, was sie zurückgibt und ein Beispiel.

Methoden

Custom domains attached to the workspace: add and remove them, read the DNS records to publish or have OpenEmail write them through a connected provider, check whether they can receive and send, manage their addresses with their photos, forwarding and password sign-ins, and set the catch-all, the tracking and files domains, the DMARC policy and the brand logo.

domains->list

List the workspace's domains and their receiving state

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
list(?int $limit = null, ?string $cursor = null, ?string $apiKey = null): Page

Returns one page of the domains added to the workspace, alphabetically by domain. domains->listAll collects every page and domains->iterate walks them lazily. receiving reports the inbound checks: verified is true once verifiedAt is set, catchAll is the domain's catch all setting, lastCheckedAt is the most recent check and error is the last verification failure.

receiving and sending are independent. A verified domain can receive mail, and that says nothing about whether outbound mail from it is signed. sending.status is the signing state as the last check saw it, one of verified, pending, failed, no_identity or unknown, sending.canSend says whether a send from the domain would be accepted right now, sending.checkedAt dates that verdict, and sending.error carries the last failure. A negative verdict older than a day is treated as unknown rather than as a refusal, so canSend can be true while status is pending.

tracking reports the domain's custom tracking domain, set with domains->update, and only a tracking.status of active means tracked links and the open pixel in new mail from the domain use its host instead of the default OpenEmail host. storage reports the domain's custom files domain the same way, and only a storage.status of active means the download links for files sent from the domain use its host.

Parameter

limitint

Page size, from 1 to 100. The server defaults to 25.

cursorstring

The nextCursor of the previous page. Leave it out for the first page.

apiKeystring

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

Rückgabe

A Page of domain arrays, with items, hasMore and nextCursor. Each item has id, domain, receiving, sending, tracking, storage, logo, dmarcPolicy and createdAt.

Beispiel

$page = $client->domains->list(limit: 100); foreach ($page as $domain) {    $receiving = $domain['receiving'];     if (!$receiving['verified']) {        echo $domain['domain'], ': ', $receiving['error'] ?? 'waiting for DNS', ', checked ', $receiving['lastCheckedAt'] ?? 'never', PHP_EOL;    }}

Hinweise

  • A narrowed key still sees every domain in the workspace, whether it is narrowed by whole domains or by individual addresses.

  • Addresses, DNS records and the DMARC reading are only on domains->get. domains->listAddresses pages through the addresses on one domain.

  • The cursor is opaque and holds where the last row sat in this order, so a row deleted or edited between pages never breaks the walk: the next page starts at the first row that sorts after it. A cursor this list did not hand out is a 400 invalid_cursor.

Auch verfügbar über

API
GET /domains
TypeScript
domains.list()
Python
domains.list()
Ruby
domains.list
CLI
openemail domains list

domains->listAll

Collect every domain into one array

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
listAll(?int $limit = null, ?string $cursor = null, ?string $apiKey = null): array

Walks every page of domains->list and returns all domains in one array, alphabetically by domain. One request per page.

Parameter

limitint

Page size for each request, from 1 to 100. The server defaults to 25.

cursorstring

Starts the walk after this cursor instead of the first page.

apiKeystring

Overrides the client's API key for every page of this walk.

Rückgabe

A list of domain arrays holding every domain, each shaped like an item of domains->list.

Beispiel

$domains = $client->domains->listAll(limit: 100); $sendable = array_filter($domains, static fn(array $domain): bool => $domain['sending']['canSend']); echo count($sendable), ' of ', count($domains), ' domains can send right now', PHP_EOL;

Hinweise

  • If any page fails, the exception is thrown and the domains already fetched are discarded.

Auch verfügbar über

API
GET /domains
TypeScript
domains.listAll()
Python
domains.list_all()
Ruby
domains.list_all

domains->iterate

Stream the domains one at a time

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
iterate(?int $limit = null, ?string $cursor = null, ?string $apiKey = null): Generator

Returns a Generator that yields domains one at a time, alphabetically by domain, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and breaking out of the foreach stops the requests.

Parameter

limitint

Page size for each request, from 1 to 100. The server defaults to 25.

cursorstring

Starts the walk after this cursor instead of the first page.

apiKeystring

Overrides the client's API key for every page of this walk.

Rückgabe

A Generator that yields one domain array per step, each shaped like an item of domains->list.

Beispiel

foreach ($client->domains->iterate() as $domain) {    if ($domain['tracking']['status'] === 'failed') {        echo $domain['domain'], ': tracking domain ', $domain['tracking']['host'], ' failed, ', $domain['tracking']['error'], PHP_EOL;    }}

Hinweise

  • The generator is lazy, so an abandoned loop costs only the pages you consumed.

Auch verfügbar über

API
GET /domains
TypeScript
domains.iterate()
Python
domains.iterate()
Ruby
domains.iterate

domains->get

Read one domain with its addresses, DNS records and DMARC reading

Geltungsbereichedomains:read
Signatur
get(string $id, ?string $apiKey = null): array

Returns the same receiving and sending blocks as domains->list, plus addresses: every address on the domain as a full lower cased address with its enabled flag. Disabled addresses are listed too. domains->listAddresses returns the same addresses with their ids and labels. It also carries the tracking and storage blocks described on domains->list, whose record is the CNAME record to add at your DNS provider for the tracking domain and for the files domain.

records is every DNS record the domain uses, each with type, name, value, priority on an MX record, a purpose written to be shown to a person, and status: found when the last check saw it in public DNS, missing when it did not, and null when it has not been checked yet. Publish each one exactly as given, since the values are specific to this domain. dmarc is the domain's DMARC record as public DNS has it, with its stage, any issues, and whether a policy stricter than p=none is safe yet. It is null until the domain is verified.

Reading an unverified domain checks its DNS again when the last check is more than 20 seconds old, so polling domains->get is one way to wait for verification. domains->verify checks straight away.

The id must belong to the calling workspace. Another workspace's domain id is a 404, the same as an id that does not exist, and the domain name is not accepted in its place.

Parameter

idstringErforderlich

Domain id from domains->list, a UUID.

apiKeystring

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

Rückgabe

An array with the fields of a domains->list item plus addresses, records and dmarc. Each entry of addresses is an array with address and enabled, each entry of records an array with type, name, value, priority, purpose and status, and dmarc an array with stage, record, issues, alignmentPossible and caveat, or null.

Beispiel

$domain = $client->domains->get('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f'); echo $domain['domain'], $domain['sending']['canSend'] ? ' can send' : ' cannot send yet', PHP_EOL; foreach ($domain['records'] as $record) {    echo $record['type'], ' ', $record['name'], ' ', $record['value'], ': ', $record['status'] ?? 'not checked', PHP_EOL;}

Hinweise

  • sending.canSend is the value to branch on before a send: when it is false, emails->send from this domain is refused with 409 domain_not_sendable.

  • A narrowed key still sees every address on the domain, whether it is narrowed by whole domains or by individual addresses.

Auch verfügbar über

API
GET /domains/{id}
TypeScript
domains.get()
Python
domains.get()
Ruby
domains.get
CLI
openemail domains get

domains->create

Add a domain to the workspace

Geltungsbereichedomains:write
Signatur
create(array $body, ?string $apiKey = null): array

Adds a domain and returns it with every DNS record to publish, in the same shape as domains->get. The first DNS check runs during the call, so the status of each entry in records already says what public DNS answers with.

The domain receives mail once public DNS answers with its MX records and its _openemail-challenge TXT record, and it can send once its signing records are in place. Publish every entry in records exactly as given, since the values are specific to this domain, then call domains->verify or poll domains->get until receiving.verified is true.

A new domain starts with its catch-all on and no addresses. Create addresses with domains->createAddress, or turn the catch-all off with domains->update.

Parameter

domainstringErforderlich

A bare domain such as example.com. It is trimmed, lower cased and converted to its ASCII form, so an internationalised name is stored as punycode.

apiKeystring

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

Rückgabe

An array for the new domain with addresses empty, records holding every DNS record to publish, and dmarc null until the domain is verified.

Beispiel

use OpenEmail\Exception\ConflictException; try {    $domain = $client->domains->create(['domain' => 'example.com']);     foreach ($domain['records'] as $record) {        echo $record['type'], ' ', $record['name'], ' ', $record['value'], isset($record['priority']) ? ' priority ' . $record['priority'] : '', PHP_EOL;    }} catch (ConflictException $error) {    echo 'Not added: ', $error->errorCode, PHP_EOL;}

Hinweise

  • How many domains you can add is set by the plan of the workspace, counted within that workspace. Past it the call is refused with 403 domain_allowance_reached, and the message says which plan includes more.

  • A domain you already added is 409 domain_already_added, one somebody else added is 409 domain_claimed, one whose parent or subdomain belongs to somebody else is 409 related_domain_owned, and one that belongs to OpenEmail is 409 operator_domain. Anything that is not a hostname is 422 invalid_parameter on domain.

  • Adding a domain reaches the whole workspace, so a key or app limited to particular addresses or domains is refused with 422 capability_unsupported on domainAllowlist. Use a key with no address or domain restriction.

  • The SDK does not retry a create after a network failure. A second attempt after a lost response is refused with 409 domain_already_added, which means the first one worked: read the domain with domains->list.

Auch verfügbar über

API
POST /domains
TypeScript
domains.create()
Python
domains.create()
Ruby
domains.create
CLI
openemail domains create

domains->verify

Check a domain's DNS now

Geltungsbereichedomains:write
Signatur
verify(string $id, ?string $apiKey = null): array

Checks the DNS of the domain straight away and returns it in the same shape as domains->get. On an unverified domain it looks for the records that verify it, and receiving.verified comes back true when they are found. On a verified domain it checks the signing and return path records again and asks whether mail from the domain can be sent, so sending is fresh.

When the last check ran less than 10 seconds ago, nothing new is checked and the domain comes back as it stands, so calling it faster than that gains nothing. A record published a moment ago can take a few minutes to show up in public DNS.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

apiKeystring

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

Rückgabe

The same array as domains->get, as the check left it.

Beispiel

$domain = $client->domains->verify('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f'); while (!$domain['receiving']['verified']) {    $missing = array_filter($domain['records'], static fn(array $record): bool => $record['status'] !== 'found');     echo count($missing), ' records not found yet', PHP_EOL;     sleep(60);     $domain = $client->domains->verify($domain['id']);} echo $domain['domain'], ' is verified', PHP_EOL;

Hinweise

  • Reading an unverified domain with domains->get also checks it again when its last check is more than 20 seconds old, so either call works for polling. domains->verify needs domains:write and domains->get needs only domains:read.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • A domain id from another workspace is a 404, the same as an id that does not exist.

  • Retried automatically on network failure and retryable statuses, since a repeated check changes nothing but the time of the check.

Auch verfügbar über

API
POST /domains/{id}/verify
TypeScript
domains.verify()
Python
domains.verify()
Ruby
domains.verify
CLI
openemail domains verify

domains->update

Turn the catch-all on or off, set or remove the tracking and files domains, and set the DMARC policy

Geltungsbereichedomains:write
Signatur
update(string $id, array $patch, ?string $apiKey = null): array

catchAll true accepts mail to any address on the domain that nobody created, and the address shows up in domains->listAddresses from its first message on. False refuses mail to every address that was not created by hand, including the ones the catch-all picked up before. It applies to the whole domain, so only a key that holds the whole domain may change it.

trackingHost and storageHost set the two custom names a domain can carry once it is verified or its _openemail-challenge TXT record is published, each of them a subdomain of it. trackingHost, such as links.example.com, is the name tracked links and the open pixel use. storageHost, such as files.example.com, is the name the download links for files sent from the domain use. All four fields are optional and independent: a field left out is left alone, and for either host null or an empty string removes that name and a string sets it. A patch carrying none of them changes nothing and answers with the domain as it stands. Each value is trimmed and lower cased, and a leading https:// or http://, any path, query or fragment and any trailing dots are stripped.

A new host is validated, saved and checked in the same call, so the response already carries the result of that first check. trackingHost reports into the tracking block and storageHost into storage, and the two blocks carry the same fields. The check asks the host over HTTPS for an answer signed by OpenEmail, on /t/v/<nonce> for a tracking domain and /f/v/<nonce> for a files domain, so the host needs a CNAME record named record.name with the value record.value, with any proxying turned off. That value, also reported as target, is an address prepared for this host alone. When it could not be prepared during the call, record is null, target is an empty string and error says so, and it is finished within a few minutes without another call. Until a check passes, status is pending and new mail keeps using the default OpenEmail host. Once one passes, status is active and new mail from the domain uses the host.

Sending a host the domain already has runs the check again, unless the last check was less than 30 seconds ago, in which case the stored state comes back unchanged. A different host replaces the current one at once, so new mail uses the default host until the new one passes a check. Null or an empty string removes that name, and its block then reports status as none with host and record null.

dmarcPolicy is what the domain's DMARC record tells receivers to do with mail that fails its checks: none only monitors, quarantine sends it to spam and reject refuses it. Inboxes show the domain logo only at quarantine or reject, and where OpenEmail writes the DNS for the domain the record is updated during the call, keeping its other tags such as rua, while elsewhere you publish the DMARC record records lists.

Parameter

idstringErforderlich

Domain id from domains->list, a UUID.

catchAllbool

True accepts mail to any address on the domain that nobody created, false refuses it. Leaving the field out leaves the catch-all alone.

trackingHoststring|null

A subdomain of the domain of at most 512 characters, such as links.example.com. Null or an empty string removes the tracking domain, and leaving the field out leaves it alone.

storageHoststring|null

A subdomain of the domain of at most 512 characters, such as files.example.com. Null or an empty string removes the files domain, and leaving the field out leaves it alone.

dmarcPolicystring

none, quarantine or reject, also in OpenEmail\Constants\DomainDmarcPolicies. A policy stricter than none needs mail from the domain to be signed first. Leaving the field out leaves the policy alone.

apiKeystring

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

Rückgabe

The same array as domains->get, with receiving.catchAll, tracking, storage and dmarcPolicy as they stand after the call.

Beispiel

use OpenEmail\Constants\DomainDmarcPolicies; $domain = $client->domains->update('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', [    'trackingHost' => 'links.example.com',    'storageHost' => 'files.example.com',]); foreach (['tracking', 'storage'] as $block) {    $record = $domain[$block]['record'];     echo $block, ' is ', $domain[$block]['status'], $record === null ? '' : ', publish CNAME ' . $record['name'] . ' ' . $record['value'], PHP_EOL;} if ($domain['sending']['status'] === 'verified') {    $client->domains->update($domain['id'], ['dmarcPolicy' => DomainDmarcPolicies::QUARANTINE]);}

Hinweise

  • The host is refused with 422 invalid_tracking_host, or invalid_storage_host for the files domain, when it is not a hostname, is not a strict subdomain of the domain, is the return path host bounce.<domain>, belongs to OpenEmail or is a domain set up to receive mail. A new host on a domain whose receiving.verified is false and whose _openemail-challenge TXT record is not published yet gets 409 domain_not_verified. The domain does not have to be receiving mail for a host to be accepted. A host another domain already uses gets 409 tracking_host_in_use or storage_host_in_use, and so does a host already in use for the other feature, since one name cannot be both. A dmarcPolicy stricter than none while sending.status is not verified gets 409 domain_not_sendable, since unsigned mail from the domain would then go to spam. Every refusal names the field it came from in param, and a refused field changes nothing. The fields are applied in order, catchAll first, then trackingHost, then storageHost, then dmarcPolicy, so a patch carrying more than one can have an earlier change saved before a later field is refused. Send them in separate calls when any of them has to stand on its own.

  • Every call on a domain whose tracking domain is managed by a different OpenEmail server, removal included, gets 409 tracking_host_in_use until it is removed on that server. A files domain behaves the same way under storage_host_in_use.

  • A tracking domain and a files domain each apply to every address on the domain, so only a key that holds the whole domain may set one. A key whose domainAllowlist contains this domain is allowed through, and any other narrowed key gets 422 capability_unsupported on domainAllowlist. The catch-all and the DMARC policy need the whole domain the same way. A body key other than catchAll, trackingHost, storageHost and dmarcPolicy is a 422 unknown_parameter, and a catchAll that is not a boolean, a dmarcPolicy that is not one of the three policies, or a host field that is present but is neither a string nor null, or runs past 512 characters, is a 422 invalid_parameter. A body carrying none of the fields is not an error: it changes nothing and comes back 200.

  • OpenEmail keeps checking on its own. A host that has not passed a check yet is checked every 2 minutes in its first hour, every 10 minutes in its first day, hourly in its first week and every 6 hours after that. An active host is checked every 10 minutes, and a failed check on it is retried after 1 minute and then 2. From the third failure in a row the wait starts at 4 minutes and doubles each time, up to an hour.

  • An active host that fails one or two checks in a row still reads active, with the reason in error. It stops being used after the third, or once its last successful check is 2 hours old. New mail then goes back to the default host, and status reads failed until a check passes again.

  • A tracking domain serves only tracking paths and a files domain serves only download paths, and each answers only for mail sent by the workspace that owns it.

  • Links in mail already sent keep the host they were sent with, and that covers the download link on a file as much as a tracked link. After removing or changing a name, those links work only for as long as the old CNAME record stays in place. Setting a host up again can give it a different record.value, so publish the one the response reports.

  • Retried automatically on network failure and retryable statuses, since repeating a call that already went through finds the catch-all, the DMARC policy and the hosts already set, or already removed, and at most checks a host again.

Auch verfügbar über

API
PATCH /domains/{id}
TypeScript
domains.update()
Python
domains.update()
Ruby
domains.update
CLI
openemail domains update

domains->delete

Remove a domain from the workspace

Geltungsbereichedomains:write
Signatur
delete(string $id, ?string $apiKey = null): array

Removes the domain. Mail to it stops being accepted and nothing can be sent from it. Every address on it goes with it, their password sign-ins are revoked, its signing key is released, its tracking and files domains are retired, and the domain.deleted webhook fires. Mail already received stays in the mailbox.

Where OpenEmail wrote the DNS for this domain itself, it takes those records back, and any it could not take back are listed in leftBehind for you to remove at your DNS provider. Records you published yourself are never touched, so remove them too once the domain is gone.

There is no undo. Adding the domain again starts it from scratch.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

apiKeystring

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

Rückgabe

An array with object set to domain, id, domain, deleted set to true and leftBehind, the DNS records that have to be removed by hand, one line each.

Beispiel

use OpenEmail\Exception\ConflictException; try {    $removed = $client->domains->delete('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f');     foreach ($removed['leftBehind'] as $line) {        echo 'Remove by hand: ', $line, PHP_EOL;    }} catch (ConflictException $error) {    echo 'Kept: ', $error->errorCode, PHP_EOL;}

Hinweise

  • The last domain in a workspace cannot be removed here, because in the app removing it deletes the whole mailbox with it. The call is refused with 409 last_domain. Remove it in the app, where that is confirmed first.

  • A domain that holds reserved account addresses is refused with 409 domain_holds_reserved_addresses.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • An access token acting for a member also needs workspace:manage in that member's role, as removing one in the app does. It is console-only, so no approval can give it to an app, and without it the call is refused with 403 insufficient_authority.

  • The SDK does not retry a delete. A 404 on your own second attempt after a lost response means the first one worked.

Auch verfügbar über

API
DELETE /domains/{id}
TypeScript
domains.delete()
Python
domains.delete()
Ruby
domains.delete
CLI
openemail domains delete

domains->setLogoCertificate

Upload the mark certificate for a domain logo

Geltungsbereichedomains:write
Signatur
setLogoCertificate(string $id, array $body, ?string $apiKey = null): array

Stores the Verified Mark Certificate (VMC) or Common Mark Certificate (CMC) a certificate authority issued for the domain, replacing any there was, and points the BIMI record at it. Gmail shows the logo only with one and Apple Mail only with a VMC, and when the logo inside the certificate differs from the published one, it becomes the published one and logoFromCertificate is true.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

certificatestringErforderlich

The file the certificate authority sent, up to 128 KB: PEM text as it came, which can hold the whole chain, or a DER or PKCS #7 file encoded as base64, which OpenEmail::toBase64 does.

apiKeystring

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

Rückgabe

The same array as domains->setLogo, with certificate, an array with url, mark, expiresAt, domains and issuer, plus matchesCertificate, records and logoFromCertificate.

Beispiel

$logo = $client->domains->setLogoCertificate('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', [    'certificate' => (string) getenv('ACME_VMC_PEM'),]); echo $logo['certificate']['mark'], ' certificate, valid until ', $logo['certificate']['expiresAt'], PHP_EOL; if ($logo['logoFromCertificate']) {    echo 'The logo inside the certificate is now the published one', PHP_EOL;}

Hinweise

  • A domain that is not verified is refused with 409 domain_not_verified. A file that cannot be read, is over 128 KB, holds no VMC or CMC, was issued for a different domain or has expired is a 422 invalid_parameter on certificate whose message says which.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist. Safe to replay, so the SDK retries it after a network failure.

Auch verfügbar über

API
PUT /domains/{id}/logo/certificate
TypeScript
domains.setLogoCertificate()
Python
domains.set_logo_certificate()
Ruby
domains.set_logo_certificate
CLI
openemail domains set-logo-certificate

domains->removeLogoCertificate

Remove the mark certificate of a domain logo

Geltungsbereichedomains:write
Signatur
removeLogoCertificate(string $id, ?string $apiKey = null): array

Removes the mark certificate and deletes the stored file, while the logo stays. The BIMI record no longer points at a certificate, so Gmail and Apple Mail stop showing the logo.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

apiKeystring

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

Rückgabe

The same array as domains->setLogo, with certificate and matchesCertificate null.

Beispiel

$logo = $client->domains->removeLogoCertificate('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f'); echo 'The certificate is gone, the logo stays at ', $logo['url'] ?? 'nowhere', PHP_EOL;

Hinweise

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • Removing a certificate from a domain that has none changes nothing, so the SDK retries it after a network failure.

Auch verfügbar über

API
DELETE /domains/{id}/logo/certificate
TypeScript
domains.removeLogoCertificate()
Python
domains.remove_logo_certificate()
Ruby
domains.remove_logo_certificate
CLI
openemail domains remove-logo-certificate

domains->listAddresses

List one page of the addresses on a domain

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
listAddresses(string $id, ?int $limit = null, ?string $cursor = null, ?string $apiKey = null): Page

Returns one page of the addresses on the domain, alphabetically by address, with each one's id, label, enabled and lastReceivedAt. That covers the addresses created by hand or through the API and the ones the catch-all picked up when mail first arrived for them. Disabled addresses are listed. Removed addresses and the catch-all itself are not: the catch-all is receiving.catchAll on the domain.

domains->listAllAddresses collects every page and domains->iterateAddresses walks them lazily.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

limitint

Page size, from 1 to 100. The server defaults to 25.

cursorstring

The nextCursor of the previous page. Leave it out for the first page.

apiKeystring

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

Rückgabe

A Page of address arrays, with items, hasMore and nextCursor. Each item is shaped like what domains->getAddress returns.

Beispiel

$page = $client->domains->listAddresses('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', limit: 100); foreach ($page as $address) {    echo $address['address'], $address['enabled'] ? '' : ', switched off', ' ', $address['label'] ?? '', PHP_EOL;}

Hinweise

  • A narrowed key still sees every address on the domain, the same as domains->get.

  • A domain id from another workspace is a 404, the same as an id that does not exist.

  • The cursor is opaque. A cursor this list did not hand out is a 400 invalid_cursor.

Auch verfügbar über

API
GET /domains/{id}/addresses
TypeScript
domains.listAddresses()
Python
domains.list_addresses()
Ruby
domains.list_addresses
CLI
openemail domains list-addresses

domains->listAllAddresses

Collect every address on a domain into one array

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
listAllAddresses(    string $id,    ?int $limit = null,    ?string $cursor = null,    ?string $apiKey = null,): array

Walks every page of domains->listAddresses and returns all the addresses on the domain in one array, alphabetically by address. One request per page.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

limitint

Page size for each request, from 1 to 100. The server defaults to 25.

cursorstring

Starts the walk after this cursor instead of the first page.

apiKeystring

Overrides the client's API key for every page of this walk.

Rückgabe

A list of address arrays holding every address on the domain, each shaped like what domains->getAddress returns.

Beispiel

$addresses = $client->domains->listAllAddresses('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f'); $silent = array_filter($addresses, static fn(array $address): bool => $address['lastReceivedAt'] === null); echo count($silent), ' of ', count($addresses), ' addresses never received mail', PHP_EOL;

Hinweise

  • If any page fails, the exception is thrown and the addresses already fetched are discarded.

Auch verfügbar über

API
GET /domains/{id}/addresses
TypeScript
domains.listAllAddresses()
Python
domains.list_all_addresses()
Ruby
domains.list_all_addresses

domains->iterateAddresses

Stream the addresses on a domain one at a time

Geltungsbereichedomains:readBlättert durch die Ergebnisse
Signatur
iterateAddresses(    string $id,    ?int $limit = null,    ?string $cursor = null,    ?string $apiKey = null,): Generator

Returns a Generator that yields the addresses on the domain one at a time, alphabetically by address, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and breaking out of the foreach stops the requests.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

limitint

Page size for each request, from 1 to 100. The server defaults to 25.

cursorstring

Starts the walk after this cursor instead of the first page.

apiKeystring

Overrides the client's API key for every page of this walk.

Rückgabe

A Generator that yields one address array per step, each shaped like what domains->getAddress returns.

Beispiel

foreach ($client->domains->iterateAddresses('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f') as $address) {    echo $address['address'], ', last mail ', $address['lastReceivedAt'] ?? 'never', PHP_EOL;}

Hinweise

  • The generator is lazy, so an abandoned loop costs only the pages you consumed.

Auch verfügbar über

API
GET /domains/{id}/addresses
TypeScript
domains.iterateAddresses()
Python
domains.iterate_addresses()
Ruby
domains.iterate_addresses

domains->createAddress

Create an address on a domain

Geltungsbereichedomains:write
Signatur
createAddress(string $id, array $body, ?string $apiKey = null): array

Creates an address on the domain, enabled, and returns it. The domain does not have to be verified yet, but the address receives nothing until it is.

When the domain has its catch-all on, the new address starts with the per-address settings of the catch-all, such as its signature and tracking, apart from the privacy settings. They are copied once, not kept in step.

Creating an address that already exists, or one that was removed, is not an error: it comes back enabled, with the label you sent or none, and keeps its id. An address the catch-all picked up becomes one created by hand, so it keeps receiving when the catch-all is turned off.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

localPartstringErforderlich

The part in front of the @, 1 to 64 characters once trimmed, lower cased. Letters, digits, the backtick and ! # $ % & ' * + / = ? ^ _ { | } ~ - are allowed, and so are dots between them. * on its own is how the catch-all is written and is refused.

labelstring|null

A name for the address shown in the app, trimmed, up to 120 characters. Leave it out, or send null or an empty string, for none.

apiKeystring

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

Rückgabe

An array for the address, shaped like what domains->getAddress returns, with its id, address, label and enabled true.

Beispiel

$address = $client->domains->createAddress('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', [    'localPart' => 'support',    'label' => 'Support',]); echo 'Created ', $address['address'], ' with id ', $address['id'], PHP_EOL;

Hinweise

  • An address reserved as somebody's account address is refused with 409 address_reserved on localPart. Past the workspace limit on addresses the call is refused with 422 workspace_limit_reached.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • A domain id from another workspace is a 404, the same as an id that does not exist.

  • Retried automatically on network failure and retryable statuses, since creating the same address twice leaves one address with the same id.

Auch verfügbar über

API
POST /domains/{id}/addresses
TypeScript
domains.createAddress()
Python
domains.create_address()
Ruby
domains.create_address
CLI
openemail domains create-address

domains->getAddress

Read one address on a domain

Geltungsbereichedomains:read
Signatur
getAddress(string $id, string $addressId, ?string $apiKey = null): array

Returns one address on the domain with its label, enabled, lastReceivedAt and timestamps.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with object set to address, id, domainId, address, localPart, label, photoUrl, enabled, destination, lastReceivedAt, createdAt and updatedAt.

Beispiel

$address = $client->domains->getAddress('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); echo $address['address'], $address['enabled'] ? ' takes mail' : ' is switched off', ', last mail ', $address['lastReceivedAt'] ?? 'never', PHP_EOL;

Hinweise

  • An address id that is not on this domain, or an address that was removed, is a 404 resource_not_found, and so is a domain from another workspace.

Auch verfügbar über

API
GET /domains/{id}/addresses/{addressId}
TypeScript
domains.getAddress()
Python
domains.get_address()
Ruby
domains.get_address
CLI
openemail domains get-address

domains->updateAddress

Rename an address, turn it off and on, or choose where its mail goes

Geltungsbereichedomains:write
Signatur
updateAddress(string $id, string $addressId, array $patch, ?string $apiKey = null): array

Changes the fields you send and leaves the rest alone. label renames the address, and null or an empty string removes the name. enabled false stops the address taking mail: mail to it is refused while the sending server is still connected, so the sender gets a bounce, and nothing can be sent from it. It keeps its mail, its settings and the people who can reach it, so enabled true picks up where it left off. That is the difference from domains->deleteAddress.

destination chooses where the mail of the address goes: mailbox keeps a copy here, as an address does by default, and forward only sends it on to the destinations from domains->addAddressForwards, keeping nothing here. forward needs at least one destination that is switched on.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

labelstring|null

A new name, trimmed, up to 120 characters. Null or an empty string removes it.

enabledbool

False stops the address taking mail, true takes mail again.

destinationstring

mailbox keeps a copy of the mail here, forward only forwards it. Both are in OpenEmail\Constants\DomainAddressDestinations.

apiKeystring

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

Rückgabe

An array for the address as it stands after the change, shaped like what domains->getAddress returns.

Beispiel

$address = $client->domains->updateAddress('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70', [    'label' => 'Old support inbox',    'enabled' => false,]); echo $address['address'], $address['enabled'] ? ' takes mail' : ' is switched off', PHP_EOL;

Hinweise

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • A body key other than label, enabled and destination is a 422 unknown_parameter.

  • 'destination' => 'forward' on an address with no destination switched on is refused with 409 forward_required on destination.

  • Sending destination with an OAuth access token needs a verification code, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An access token acting for a member can only change where the mail of an address goes when that member reaches it, or it is refused with 403 insufficient_authority. An API key is never asked for a code.

  • Retried automatically on network failure and retryable statuses, since the same patch sent twice leaves the same address.

Auch verfügbar über

API
PATCH /domains/{id}/addresses/{addressId}
TypeScript
domains.updateAddress()
Python
domains.update_address()
Ruby
domains.update_address
CLI
openemail domains update-address

domains->setAddressPhoto

Upload the photo shown for an address

Geltungsbereichedomains:write
Signatur
setAddressPhoto(    string $id,    string $addressId,    mixed $data,    ?string $contentType = null,    ?string $apiKey = null,): array

Sends the image bytes as the request body, replacing any photo the address had: PNG, JPEG, WebP or GIF up to 5 MB, cropped to a 512 pixel square, stored as JPEG or PNG and shown for the address in OpenEmail in place of the domain logo. The type is read from contentType:, or when that is left out from the media type a PSR-7 uploaded file declares, or from the extension of the file an SplFileInfo or a stream points at, and without any of these the server refuses the bytes with 422 invalid_image.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

datastring|resource|SplFileInfo|StreamInterfaceErforderlich

The image: a string of bytes, a stream resource, an SplFileInfo or a PSR-7 stream or uploaded file.

contentTypestring

image/png, image/jpeg, image/webp or image/gif. Required for a string of bytes, and for a file or stream whose name does not end in .png, .jpg, .jpeg, .webp or .gif.

apiKeystring

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

Rückgabe

An array for the address, shaped like what domains->getAddress returns, with the new photoUrl.

Beispiel

$address = $client->domains->setAddressPhoto(    'b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f',    '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70',    new \SplFileInfo('avatar.png'),); echo $address['address'], ' now shows ', $address['photoUrl'], PHP_EOL;

Hinweise

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • A busy image service answers 503 image_busy and a failed save 502 image_not_stored, which the SDK retries like any other retryable status.

Auch verfügbar über

API
PUT /domains/{id}/addresses/{addressId}/photo
TypeScript
domains.setAddressPhoto()
Python
domains.set_address_photo()
Ruby
domains.set_address_photo
CLI
openemail domains set-address-photo

domains->removeAddressPhoto

Remove the photo of an address

Geltungsbereichedomains:write
Signatur
removeAddressPhoto(string $id, string $addressId, ?string $apiKey = null): array

Removes the photo of the address and deletes the stored image, so the domain logo is shown for it again.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array for the address, shaped like what domains->getAddress returns, with photoUrl null.

Beispiel

$address = $client->domains->removeAddressPhoto('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); echo $address['address'], ' shows ', $address['photoUrl'] ?? 'the domain logo', PHP_EOL;

Hinweise

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • Removing a photo from an address that has none changes nothing, so the SDK retries it after a network failure.

Auch verfügbar über

API
DELETE /domains/{id}/addresses/{addressId}/photo
TypeScript
domains.removeAddressPhoto()
Python
domains.remove_address_photo()
Ruby
domains.remove_address_photo
CLI
openemail domains remove-address-photo

domains->deleteAddress

Remove an address from a domain

Geltungsbereichedomains:write
Signatur
deleteAddress(string $id, string $addressId, ?string $apiKey = null): array

Removes the address. Mail to it is refused from then on, even when the catch-all on the domain is on. Its forwarding stops, its settings are deleted, the people who were given access to it lose that access, and its password sign-in is revoked. Mail it already received stays in the mailbox.

Creating the same address again with domains->createAddress brings it back with the same id, enabled, but without its old settings or access.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with object set to address, id, address and deleted set to true.

Beispiel

$removed = $client->domains->deleteAddress('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); echo 'Removed ', $removed['address'], PHP_EOL;

Hinweise

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • An access token acting for a member also needs workspace:manage in that member's role, as removing one in the app does. It is console-only, so no approval can give it to an app, and without it the call is refused with 403 insufficient_authority.

  • The SDK does not retry a delete. A 404 on your own second attempt after a lost response means the first one worked.

Auch verfügbar über

API
DELETE /domains/{id}/addresses/{addressId}
TypeScript
domains.deleteAddress()
Python
domains.delete_address()
Ruby
domains.delete_address
CLI
openemail domains delete-address

domains->listAddressForwards

List where the mail of an address is forwarded

Geltungsbereichedomains:read
Signatur
listAddressForwards(string $id, string $addressId, ?string $apiKey = null): array

Returns every place the mail of the address is forwarded to, oldest first, as the Forwarding section of the address in the app lists them. Each destination says whether it is switched on (enabled) and where it stands (status): only a live destination, one that confirmed by email that it wants this mail, receives anything.

destination on the list says whether the address also keeps a copy of its mail here (mailbox) or only forwards it (forward), and max is how many destinations one address may have.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with address, destination, max and the destinations in data, a list of arrays each with id, email, enabled, status, confirmedAt, askedAt, lastRelayAt, lastError, failures and createdAt.

Beispiel

use OpenEmail\Constants\AddressForwardStatuses; $forwards = $client->domains->listAddressForwards('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); echo $forwards['address'], ' goes to ', $forwards['destination'], ', ', count($forwards['data']), ' of ', $forwards['max'], ' destinations used', PHP_EOL; foreach ($forwards['data'] as $forward) {    echo '  ', $forward['email'], ' ', $forward['status'], $forward['status'] === AddressForwardStatuses::PENDING ? ', waiting for confirmation' : '', PHP_EOL;}

Hinweise

  • An address id that is not on this domain, or an address that was removed, is a 404 resource_not_found, and so is a domain from another workspace.

  • A GET is retried automatically on network failure and on 408, 429, 500, 502, 503 and 504 responses, up to the client's maxRetries.

Auch verfügbar über

API
GET /domains/{id}/addresses/{addressId}/forwards
TypeScript
domains.listAddressForwards()
Python
domains.list_address_forwards()
Ruby
domains.list_address_forwards
CLI
openemail domains list-address-forwards

domains->addAddressForwards

Forward the mail of an address to more places

Geltungsbereichedomains:write
Signatur
addAddressForwards(string $id, string $addressId, array $body, ?string $apiKey = null): array

Adds places the mail of the address goes to, as adding a destination in the app does. Each new destination is sent an email asking it to confirm, and receives nothing until it does, so it comes back pending and turns live once its owner confirms.

An address hosted here, one already on the list, one that would make a loop, one past the limit of 10 and one that refused mail from this workspace before are not added. Each is named in skipped with the reason, and the rest are still added.

The address keeps a copy of its mail here as before. To stop keeping one, set destination to forward with domains->updateAddress once a destination is switched on.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

emailsstring[]Erforderlich

The addresses to forward to, 1 to 10 of them. Each is trimmed and lowercased.

apiKeystring

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

Rückgabe

An array with the destinations added in added, and every address that was not, with the reason, in skipped.

Beispiel

$result = $client->domains->addAddressForwards('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70', [    'emails' => ['[email protected]', '[email protected]'],]); foreach ($result['added'] as $forward) {    echo 'Asked ', $forward['email'], ' to confirm', PHP_EOL;} foreach ($result['skipped'] as $skipped) {    echo 'Skipped ', $skipped['email'], ': ', $skipped['reason'], PHP_EOL;}

Hinweise

  • An address that is switched off is refused with 409 address_disabled. Switch it on with domains->updateAddress first.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist. An access token acting for a member can only change the forwarding of an address that member reaches, or it is refused with 403 insufficient_authority.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried automatically by the SDK, since a lost attempt may already have asked a destination to confirm.

Auch verfügbar über

API
POST /domains/{id}/addresses/{addressId}/forwards
TypeScript
domains.addAddressForwards()
Python
domains.add_address_forwards()
Ruby
domains.add_address_forwards
CLI
openemail domains add-address-forwards

domains->updateAddressForward

Pause a forwarding destination or switch it back on

Geltungsbereichedomains:write
Signatur
updateAddressForward(    string $id,    string $addressId,    string $forwardId,    array $patch,    ?string $apiKey = null,): array

enabled false pauses the destination: nothing is forwarded to it until it is switched on again. It keeps its confirmation, so switching it back on needs no new one, and switching it on clears the failures recorded against it.

When the last destination that is on is paused, the address goes back to keeping its mail here. destination in the result says where the mail of the address goes now.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

forwardIdstringErforderlich

A destination id from domains->listAddressForwards or domains->addAddressForwards. It has to be a destination of the address named by addressId.

enabledboolErforderlich

False pauses the destination, true switches it back on.

apiKeystring

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

Rückgabe

An array for the destination as it is now, with id, email, enabled, status and destination for the address.

Beispiel

$forward = $client->domains->updateAddressForward(    'b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f',    '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70',    '5e8f1a2b-3c4d-4e5f-8a9b-0c1d2e3f4a5b',    ['enabled' => false],); echo $forward['email'], ' is ', $forward['status'], ', the mail of the address now goes to ', $forward['destination'], PHP_EOL;

Hinweise

  • A destination id that is not on this address is a 404 resource_not_found.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist. An access token acting for a member can only change the forwarding of an address that member reaches, or it is refused with 403 insufficient_authority.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Retried automatically on network failure, since the same patch sent twice leaves the same destination.

Auch verfügbar über

API
PATCH /domains/{id}/addresses/{addressId}/forwards/{forwardId}
TypeScript
domains.updateAddressForward()
Python
domains.update_address_forward()
Ruby
domains.update_address_forward
CLI
openemail domains update-address-forward

domains->deleteAddressForward

Stop forwarding to a destination

Geltungsbereichedomains:write
Signatur
deleteAddressForward(    string $id,    string $addressId,    string $forwardId,    ?string $apiKey = null,): array

Removes the destination, so nothing more is forwarded to it. When it was the last destination that was on, the address goes back to keeping its mail here, and destination in the result says where the mail of the address goes now.

To stop forwarding for a while instead, pause the destination with domains->updateAddressForward, which keeps its confirmation.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

forwardIdstringErforderlich

A destination id from domains->listAddressForwards or domains->addAddressForwards. It has to be a destination of the address named by addressId.

apiKeystring

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

Rückgabe

An array with object set to address_forward, id, addressId, email, deleted set to true and destination.

Beispiel

$removed = $client->domains->deleteAddressForward(    'b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f',    '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70',    '5e8f1a2b-3c4d-4e5f-8a9b-0c1d2e3f4a5b',); echo 'Stopped forwarding to ', $removed['email'], ', the mail now goes to ', $removed['destination'], PHP_EOL;

Hinweise

  • A destination id that is not on this address is a 404 resource_not_found.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist. An access token acting for a member can only change the forwarding of an address that member reaches, or it is refused with 403 insufficient_authority.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried by the SDK. Repeating a delete that succeeded is a 404.

Auch verfügbar über

API
DELETE /domains/{id}/addresses/{addressId}/forwards/{forwardId}
TypeScript
domains.deleteAddressForward()
Python
domains.delete_address_forward()
Ruby
domains.delete_address_forward
CLI
openemail domains delete-address-forward

domains->resendAddressForwardConsent

Ask a forwarding destination to confirm again

Geltungsbereichedomains:write
Signatur
resendAddressForwardConsent(    string $id,    string $addressId,    string $forwardId,    ?string $apiKey = null,): array

Sends the confirmation email to the destination once more, for when the first one was lost or ignored. status says what became of the request: sent, already-confirmed when the destination has confirmed and needs nothing, too-soon when the last email went out moments ago, revoked when the destination refused mail from this workspace, and send-failed when the email could not be sent.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

forwardIdstringErforderlich

A destination id from domains->listAddressForwards or domains->addAddressForwards. It has to be a destination of the address named by addressId.

apiKeystring

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

Rückgabe

An array with the destination id, addressId, email and the status of the request.

Beispiel

use OpenEmail\Constants\AddressForwardConsentStatuses; $consent = $client->domains->resendAddressForwardConsent(    'b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f',    '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70',    '5e8f1a2b-3c4d-4e5f-8a9b-0c1d2e3f4a5b',); echo match ($consent['status']) {    AddressForwardConsentStatuses::SENT => 'Asked ' . $consent['email'] . ' again',    AddressForwardConsentStatuses::TOO_SOON => 'The last email went out moments ago',    default => 'Not sent: ' . $consent['status'],}, PHP_EOL;

Hinweise

  • A destination id that is not on this address is a 404 resource_not_found.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist. An access token acting for a member can only change the forwarding of an address that member reaches, or it is refused with 403 insufficient_authority.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried automatically by the SDK, since every attempt can send an email.

Auch verfügbar über

API
POST /domains/{id}/addresses/{addressId}/forwards/{forwardId}/resend
TypeScript
domains.resendAddressForwardConsent()
Python
domains.resend_address_forward_consent()
Ruby
domains.resend_address_forward_consent
CLI
openemail domains resend-address-forward-consent

domains->listAddressMembers

List who can reach an address

Geltungsbereichemembers:read
Signatur
listAddressMembers(string $id, string $addressId, ?string $apiKey = null): array

Returns everybody who can read the mail of the address and how each one reaches it, in via: owner for the owner of the workspace, every-address for a role that reaches every address, whole-domain for a grant of the whole domain named in viaDomain, and direct for a grant of the address itself. Each person appears once.

access is member for somebody who reads and sends from the address and viewer for somebody who only reads it. removable is true for a grant of the address itself, which members->revokeAddress takes back. The others come from the role or a domain grant, and change there.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with the people in data, a list of arrays each with userId, email, name, image, access, via, viaDomain and removable.

Beispiel

use OpenEmail\Constants\AddressMemberVias; $members = $client->domains->listAddressMembers('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); foreach ($members['data'] as $member) {    $how = $member['via'] === AddressMemberVias::WHOLE_DOMAIN ? 'the whole of ' . $member['viaDomain'] : $member['via'];     echo $member['email'], ' as ', $member['access'], ' through ', $how, $member['removable'] ? ', removable here' : '', PHP_EOL;}

Hinweise

  • An address id that is not on this domain, or an address that was removed, is a 404 resource_not_found, and so is a domain from another workspace.

  • A GET is retried automatically on network failure and on 408, 429, 500, 502, 503 and 504 responses, up to the client's maxRetries.

Auch verfügbar über

API
GET /domains/{id}/addresses/{addressId}/members
TypeScript
domains.listAddressMembers()
Python
domains.list_address_members()
Ruby
domains.list_address_members
CLI
openemail domains list-address-members

domains->getAddressLogin

Read the password sign-in of an address

Geltungsbereichemembers:write
Signatur
getAddressLogin(string $id, string $addressId, ?string $apiKey = null): array

Says whether the address has a password of its own, which lets somebody sign in to OpenEmail as that address alone and read and send only its mail. login is null when it has none, and otherwise says who set the password and when, and when it was last used to sign in.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with addressId, address and login, which is null when the address has no password and otherwise an array with userId, name, createdAt, createdBy, passwordSetAt, passwordSetBy and lastSignedInAt.

Beispiel

$result = $client->domains->getAddressLogin('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70'); $login = $result['login']; if ($login === null) {    echo $result['address'], ' has no password sign-in', PHP_EOL;} else {    echo 'Password set by ', $login['passwordSetBy'], ' at ', $login['passwordSetAt'], ', last sign-in ', $login['lastSignedInAt'] ?? 'never', PHP_EOL;}

Hinweise

  • It needs members:write, the scope that sets a password, as the app does, rather than a read scope.

  • An address id that is not on this domain, or an address that was removed, is a 404 resource_not_found, and so is a domain from another workspace.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported. An access token acting for a member can only reach the sign-in of an address that member reaches, or it is refused with 403 insufficient_authority.

  • A GET is retried automatically on network failure and on 408, 429, 500, 502, 503 and 504 responses, up to the client's maxRetries.

Auch verfügbar über

API
GET /domains/{id}/addresses/{addressId}/login
TypeScript
domains.getAddressLogin()
Python
domains.get_address_login()
Ruby
domains.get_address_login
CLI
openemail domains get-address-login

domains->setAddressLogin

Give an address a password, or replace it

Geltungsbereichemembers:write
Signatur
setAddressLogin(string $id, string $addressId, array $body, ?string $apiKey = null): array

Sets the password somebody uses to sign in to OpenEmail as this address alone. Whoever holds it reads and sends only the mail of the address and reaches nothing else in the workspace. OpenEmail sends the password to nobody, so hand it over yourself.

Calling it again replaces the password, signs out everybody who signed in with the old one and removes the forwarding destinations they added. created says whether the sign-in is new.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

passwordstringErforderlich

At least 8 characters, with a lowercase letter, an uppercase letter, a number and a special character.

apiKeystring

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

Rückgabe

The same array as domains->getAddressLogin, as it stands after the change, with created.

Beispiel

$password = 'Aa1!' . bin2hex(random_bytes(8)); $login = $client->domains->setAddressLogin('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70', [    'password' => $password,]); echo $login['created'] ? 'New sign-in for ' : 'Password replaced for ', $login['address'], PHP_EOL;echo 'Hand this password over yourself: ', $password, PHP_EOL;

Hinweise

  • A password that misses a rule is a 422 invalid_parameter on password. An address an OpenEmail account already signs in as is refused with 409 account_exists, so invite that account to the workspace instead, and an address that is switched off is refused with 409 address_unavailable.

  • The first password on a workspace whose plan has no team access is refused with 403 plan_required.

  • A key or an access token has to hold every scope a sign-in for one address may use, or it is refused with 403 insufficient_authority. A key limited to particular addresses or domains is refused with 422 capability_unsupported, and an access token acting for a member can only set the password of an address that member reaches with member access.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried automatically by the SDK.

Auch verfügbar über

API
PUT /domains/{id}/addresses/{addressId}/login
TypeScript
domains.setAddressLogin()
Python
domains.set_address_login()
Ruby
domains.set_address_login
CLI
openemail domains set-address-login

domains->deleteAddressLogin

Remove the password sign-in of an address

Geltungsbereichemembers:write
Signatur
deleteAddressLogin(string $id, string $addressId, ?string $apiKey = null): array

Takes the password away and signs out everybody who signed in with it. The address, its mail and the people who reach it otherwise stay as they are, and the forwarding destinations added by whoever signed in as the address are removed with it.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

addressIdstringErforderlich

Address id from domains->listAddresses or domains->createAddress, a UUID. It has to be an address on the domain named by id.

apiKeystring

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

Rückgabe

An array with object set to address_login, addressId, address and deleted set to true.

Beispiel

use OpenEmail\Exception\NotFoundException; try {    $removed = $client->domains->deleteAddressLogin('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', '7c9d2e41-0b8f-4a63-9e25-1f4d6a8b3c70');     echo 'Nobody can sign in as ', $removed['address'], ' with a password now', PHP_EOL;} catch (NotFoundException) {    echo 'The address had no password', PHP_EOL;}

Hinweise

  • An address with no password is a 404.

  • A key limited to particular addresses or domains is refused with 422 capability_unsupported. An access token acting for a member can only reach the sign-in of an address that member reaches, or it is refused with 403 insufficient_authority.

  • Not retried by the SDK. Repeating a delete that succeeded is a 404.

Auch verfügbar über

API
DELETE /domains/{id}/addresses/{addressId}/login
TypeScript
domains.deleteAddressLogin()
Python
domains.delete_address_login()
Ruby
domains.delete_address_login
CLI
openemail domains delete-address-login

domains->getDns

Read how the DNS of a domain is set up

Geltungsbereichedomains:read
Signatur
getDns(string $id, ?bool $refresh = null, ?string $apiKey = null): array

Returns whether OpenEmail writes the records of the domain itself (managing), through which connection and zone, where each kind of record stands in steps, and the records left behind to delete by hand.

zone says which connected zone answers for the domain: one is resolved, several are ambiguous and need domains->setDnsZone, none holds it, with the reason, or the connections could not be asked (unusable). The answer is kept for a few minutes, and refresh: asks the providers again.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

refreshbool

True asks the providers again which zone answers for the domain.

apiKeystring

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

Rückgabe

An array with domainId, domain, managing, connectionId, connection, zoneId, zoneName, state, steps, leftovers, error, syncedAt and zone, whose kind is one of the four answers above and whose candidates are the zones to choose from.

Beispiel

use OpenEmail\Constants\DnsZoneResolutionKinds; $dns = $client->domains->getDns('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', refresh: true); echo $dns['domain'], $dns['managing'] ? ' is written through ' . $dns['zoneName'] : ' is not written by OpenEmail', PHP_EOL; foreach ($dns['steps'] as $step) {    echo '  ', $step['purpose'], ': ', $step['ok'] ? 'in place' : $step['detail'], PHP_EOL;} if (($dns['zone']['kind'] ?? null) === DnsZoneResolutionKinds::AMBIGUOUS) {    echo 'Several zones answer, so choose one with domains->setDnsZone', PHP_EOL;}

Hinweise

  • A domain id that is not in this workspace is a 404 resource_not_found.

  • A GET is retried automatically on network failure and on 408, 429, 500, 502, 503 and 504 responses, up to the client's maxRetries.

Auch verfügbar über

API
GET /domains/{id}/dns
TypeScript
domains.getDns()
Python
domains.get_dns()
Ruby
domains.get_dns
CLI
openemail domains get-dns

domains->setDnsZone

Choose the zone a domain is set up through

Geltungsbereichedomains:write
Signatur
setDnsZone(string $id, array $body, ?string $apiKey = null): array

Attaches the domain to a zone of a connection, when several connected zones could answer for it. The zone has to cover the domain, be active at the provider and take a test record. Nothing is written yet: call domains->syncDns to write the records.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

connectionIdstringErforderlich

The connection that holds the zone, from dnsConnections->list.

zoneIdstringErforderlich

The zone, as the candidates in zone of domains->getDns list it.

apiKeystring

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

Rückgabe

The same array as domains->getDns, as it stands after the change.

Beispiel

$dns = $client->domains->getDns('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f', refresh: true); $candidate = $dns['zone']['candidates'][0] ?? null; if ($candidate !== null) {    $dns = $client->domains->setDnsZone($dns['domainId'], [        'connectionId' => $candidate['connectionId'],        'zoneId' => $candidate['zone']['id'],    ]);     echo $dns['domain'], ' is attached to ', $dns['zoneName'], PHP_EOL;}

Hinweise

  • A zone that does not cover the domain is a 422 invalid_parameter on zoneId. A domain already set up through another zone is refused with 409 dns_zone_conflict, a zone that is not active or refuses the test record with 409 dns_zone_unusable, and a connection that was disconnected with 409 dns_connection_unusable.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried by the SDK.

Auch verfügbar über

API
PUT /domains/{id}/dns
TypeScript
domains.setDnsZone()
Python
domains.set_dns_zone()
Ruby
domains.set_dns_zone
CLI
openemail domains set-dns-zone

domains->syncDns

Write the DNS records of a domain

Geltungsbereichedomains:write
Signatur
syncDns(string $id, ?array $body = null, ?string $apiKey = null): array

Writes or repairs every record the domain needs through the connected zone that answers for it, as Sync does in the app. When exactly one zone answers it is attached first, and attached says so. With purpose, only that kind of record is written. A domain that was waiting for its records is verified once they are in place.

When no single zone answers, nothing is written: outcome is refused, message says why and zone shows the zones to choose from with domains->setDnsZone.

Parameter

idstringErforderlich

Domain id from domains->list or domains->create, a UUID.

purposestring

Only this kind of record: dmarc, tracking, storage, bimi or app-host, also in OpenEmail\Constants\DnsSyncPurposes.

apiKeystring

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

Rückgabe

An array with outcome, message, attached, the provision that ran and the DNS setup as it is now in dns, shaped like what domains->getDns returns.

Beispiel

use OpenEmail\Constants\DnsSyncOutcomes; $sync = $client->domains->syncDns('b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f'); if ($sync['outcome'] === DnsSyncOutcomes::REFUSED) {    echo 'Nothing written: ', $sync['message'], PHP_EOL;} else {    foreach ($sync['provision']['written'] ?? [] as $record) {        echo $record['mode'], ' ', $record['type'], ' ', $record['name'], PHP_EOL;    }}

Hinweise

  • A sync already running on the domain is refused with 409 dns_busy. A provider that refuses the request is a 502 dns_provider_error.

  • A key limited to particular addresses or domains has to hold this whole domain in its domainAllowlist, or the call is refused with 422 capability_unsupported on domainAllowlist.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. isStepUpRequired() on the error says so. An API key is never asked for a code.

  • Not retried by the SDK.

Auch verfügbar über

API
POST /domains/{id}/dns/sync
TypeScript
domains.syncDns()
Python
domains.sync_dns()
Ruby
domains.sync_dns
CLI
openemail domains sync-dns