thunderbird_accounts.mail.clients

Classes

DNSRecordStatus(*values)

DkimSignatureStage(*values)

Stalwart DKIM signature rotation stages.

DomainVerificationErrors(*values)

Domain verification error codes returned by check_domain_dns().

MailClient()

A partial api client for Stalwart Docs: https://stalw.art/docs/api/management/endpoints Code: https://github.com/stalwartlabs/stalwart/tree/main/crates/http/src/management

StaleDNSRecordCode(*values)

Stale DNS records that should be removed to prevent issues with the Thundermail setup.

StalwartErrors(*values)

Errors defined in Stalwart's management api https://github.com/stalwartlabs/stalwart/blob/4d819a1041b0adfce3757df50929764afa10e27b/crates/http/src/management/mod.rs#L58

class thunderbird_accounts.mail.clients.StalwartErrors(*values)[source]

Bases: StrEnum

Errors defined in Stalwart’s management api https://github.com/stalwartlabs/stalwart/blob/4d819a1041b0adfce3757df50929764afa10e27b/crates/http/src/management/mod.rs#L58

class thunderbird_accounts.mail.clients.DomainVerificationErrors(*values)[source]

Bases: StrEnum

Domain verification error codes returned by check_domain_dns().

class thunderbird_accounts.mail.clients.DkimSignatureStage(*values)[source]

Bases: StrEnum

Stalwart DKIM signature rotation stages.

class thunderbird_accounts.mail.clients.DNSRecordStatus(*values)[source]

Bases: StrEnum

class thunderbird_accounts.mail.clients.StaleDNSRecordCode(*values)[source]

Bases: StrEnum

Stale DNS records that should be removed to prevent issues with the Thundermail setup.

class thunderbird_accounts.mail.clients.MailClient[source]

Bases: object

A partial api client for Stalwart Docs: https://stalw.art/docs/api/management/endpoints Code: https://github.com/stalwartlabs/stalwart/tree/main/crates/http/src/management

Important note: The principal_id field is principal object’s name, not auto-incremented id!

__init__()[source]
get_telemetry()[source]

We actually only use this for the health check

create_dkim(domain, stage: DkimSignatureStage = DkimSignatureStage.PENDING, algorithms=None)[source]

Creates DKIM keys in Stalwart. Return list of response objects. Response objects may used for testing. Throws exception if request fails.

get_dkim_selectors(domain_name: str) set[str][source]

Return DKIM selectors already present in Stalwart’s DNS records.

ensure_dkim(domain_name: str, stage: DkimSignatureStage = DkimSignatureStage.PENDING) list[dict][source]

Create only the configured DKIM selectors that are missing.

activate_pending_dkim_signatures(domain_name: str) list[str][source]

Activate pending DKIM signatures after their DNS records have been verified.

delete_dkim(domain) Response | None[source]

Removes all dkim signatures for a given domain from Stalwart.

Returns None if there’s nothing to delete, otherwise returns the delete response.

delete_account(principal_id: str)[source]

Deletes a Stalwart principal object from the given principal_id

save_email_addresses(principal_id: str, emails: str | list[str])[source]

Adds a new email address to a stalwart’s individual principal by uuid.

replace_email_addresses(principal_id: str, emails: list[tuple[str, str]])[source]

Replaces an email address with a new one from a stalwart’s individual principal by uuid.

delete_email_addresses(principal_id: str, emails: str | list[str])[source]

Deletes an address from a stalwart’s individual principal by uuid.

update_individual(principal_id: str, primary_email_address: str | None = None, full_name: str | None = None)[source]

Updates Stalwart and changes their primary email address and/or full name

delete_domain(domain_name: str)[source]

Deletes a Stalwart domain object from the given domain_name

build_expected_dns_records(cust_domain: str) list[dict][source]

Build the full list of DNS records the user must configure for a customer domain.

check_domain_dns(domain_name: str) dict[source]

Check expected DNS records and return verification details for a custom domain.