thunderbird_accounts.mail.utils

Functions

add_email_addresses_to_stalwart_account(...)

create_stalwart_account(user[, app_password])

decode_app_password(secret)

delete_email_addresses_from_stalwart_account(...)

filter_app_passwords(secrets, *[, filter_prefix])

Return app-password secrets with Appointment CalDAV entry excluded.

fix_archives_folder(access_token, account)

Check if the archive folder exists, if it doesn't create it! This fixes a bug with our stalwart instance where it doesn't give us an archives folder...

is_address_taken(email_address)

Checks an email address (thundermail address or custom alias, not recovery email!) against known user's recovery email, thundermail address or custom aliases.

is_allowed_domain(email_address)

Pass in an email address and see if it's a valid / allowed email domain

replace_email_addresses_on_stalwart_account(...)

save_app_password(label, password)

Hashes a given password, formats it with the label and saves it to the secret field.

update_quota_on_stalwart_account(user, quota)

validate_email(email[, error_message, ...])

Validates the email and local part against Django's built-in email validation.

thunderbird_accounts.mail.utils.validate_email(email: str, error_message: str | None = None, min_length: int | None = None) bool[source]

Validates the email and local part against Django’s built-in email validation.

min_length overrides User.USERNAME_MIN_LENGTH when the caller has already enforced its own domain-specific minimum (e.g. the add_email_alias view).

thunderbird_accounts.mail.utils.save_app_password(label, password)[source]

Hashes a given password, formats it with the label and saves it to the secret field.

thunderbird_accounts.mail.utils.filter_app_passwords(secrets: list[str], *, filter_prefix: str | None = None) list[str][source]

Return app-password secrets with Appointment CalDAV entry excluded.

If filter_prefix is given, only secrets whose label starts with that prefix are kept (all others are returned). By default the APPOINTMENT_APP_PASSWORD_PREFIX is stripped out.

thunderbird_accounts.mail.utils.fix_archives_folder(access_token, account: Account) bool[source]

Check if the archive folder exists, if it doesn’t create it! This fixes a bug with our stalwart instance where it doesn’t give us an archives folder…

This function is a little messy, and will hopefully be removed in the future.

thunderbird_accounts.mail.utils.is_allowed_domain(email_address: str) bool[source]

Pass in an email address and see if it’s a valid / allowed email domain

thunderbird_accounts.mail.utils.is_address_taken(email_address: str) bool[source]

Checks an email address (thundermail address or custom alias, not recovery email!) against known user’s recovery email, thundermail address or custom aliases.