feat(email): the report, invites, resets and test sends go through the outbox; only it talks SMTP (#5508)
#5508 "Every other email through the outbox: weekly report, invites, password resets, and the test buttons" (milestone 501). - outbox.send_each queues one email per reader (claimed, so the sender doesn't take it too) and tries them at once, for a page that answers with what happened; outbox.said words the result. attempt takes a cfg for a test of the form's unsaved settings and returns the settled rows. - Weekly report (scheduled and Send now) and invites: queued, tried at once; one the server couldn't take yet is retried for an hour. An invite that didn't go shows its link with the reason, as before. - Password reset: queued in the reset link's own transaction; the sender delivers it on its next tick. - Settings -> Notifications test email and a rule's Send test: queued and recorded with retry=False, tried once (System 156 ruling). - Removed mail.send, notifications._send_email and _smtp_send_sync; dispatch_notifications is webhook only. A guard asserts only the outbox (and smtp_open itself) opens an SMTP connection, with a self-test. Also fixes run 8941 (#5507's integration test): its Also-send-to addresses were "@test", which is_real_address rightly drops; they are example.com now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -163,13 +163,6 @@ async def audience(db) -> dict:
|
||||
return out
|
||||
|
||||
|
||||
async def send(cfg: dict, messages: list[EmailMessage]) -> None:
|
||||
"""Send every message over one SMTP connection, off the event loop."""
|
||||
import asyncio
|
||||
from steward.core.notifications import _smtp_send_sync
|
||||
await asyncio.get_running_loop().run_in_executor(None, _smtp_send_sync, cfg, messages)
|
||||
|
||||
|
||||
def _render(name: str, **ctx) -> tuple[str, str]:
|
||||
ctx = {"c": palette(), **ctx}
|
||||
return (_env.get_template(f"{name}.txt").render(ctx),
|
||||
|
||||
Reference in New Issue
Block a user