Skip to main content

Module email_deliveries

Module email_deliveries 

Source

Structs§

CheckUserAndTemplateRow 🔒
Email
EmailDelivery
EmailDeliveryError
EmailDeliveryErrorInsert
EmailSendStatusFacts
The delivery-row facts derive_email_send_status needs, so the derivation itself is pure.
EmailSendStatusReport
The shared payload for every surface that reports on a queued email.
UserEmailDeliverySummary
One delivery attempt, as summarized for a support-facing view of a user’s mail history.

Enums§

EmailSendStatus
What we can honestly say about an email we queued.

Constants§

FETCH_LIMIT
PURGE_CHANCE_IN 🔒
One purge in this many calls, matching the token cleanups. The caller schedules how often it asks.
RECIPIENT_ADDRESS_RETENTION 🔒
How long a delivery to a raw address may keep that address after being queued.
RETRY_WINDOW_SECS
How long a delivery keeps being retried after its first failure.

Functions§

derive_email_send_status
The one derivation of send status. Every surface goes through it.
fetch_emails
get_recent_deliveries_for_user
A user’s most recent email deliveries, newest first, for support tooling.
get_recent_template_types_for_user_for_testing
Which mails one account has been queued, newest first. There is no mail capture in this repo, so a system test asserting a message was composed reads the queue instead of an inbox.
get_send_status
get_send_statuses
increment_retry_and_mark_non_retryable
increment_retry_and_schedule
insert_delivery_for_user 🔒
insert_email_delivery
Inserts an email delivery; fails if the user or email template is soft-deleted.
insert_email_delivery_error
insert_email_delivery_to_address
Queues an email to a raw address, for recipients who may have no account here.
insert_email_delivery_with_placeholders
Queues a mail to an account, carrying its substitutions on the delivery row.
is_hard_send_failure
True once a delivery attempt has failed for good: not retryable at all, or retryable but its retry window has expired. Shared with credit_registration_account_linking_emails.rs so the two cannot drift on what counts as a hard failure.
mark_as_sent
maybe_purge_expired_recipient_addresses
Probabilistic purge instead of a cron, in the style of the token cleanups.
soft_delete_unsent_retryable_deliveries_for_user
Soft-deletes unsent, still-retryable email deliveries for a user. Call when soft-deleting the user so pending deliveries are not retried.