thunderbird_accounts.mail.clients

Classes

DomainVerificationErrors(*values)

Domain verification error codes returned by verify_domain()

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

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 verify_domain()

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

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

verify_domain(domain_name: str)[source]

Verify domain using dnspython.

Checks: 1. MX Records exist and point to the correct host (Critical, fails verification) 2. SPF Record exists and includes the correct host (Warning if missing) 3. DKIM Record exists (Warning if missing)

Returns:
tuple: (is_verified, critical_errors, warnings)
  • is_verified: True if verification completed successfully without critical errors

  • critical_errors: List of errors (e.g., DomainVerificationErrors.MX_LOOKUP_ERROR)

  • warnings: List of warnings (e.g., DomainVerificationErrors.SPF_RECORD_NOT_FOUND)