thunderbird_accounts.mail.clients

Classes

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.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 Stalwart’s troubleshooting API with SSE streaming.

This implementation follows the Stalwart web-admin approach: 1. Get a troubleshooting token 2. Stream delivery stages via SSE 3. Collect stages until completion

Args:

domain_name: The domain to verify/troubleshoot

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

  • critical_errors: List of stage types that had errors

  • warnings: List of stage types that had warnings