Skip to content

fix(mail): remove lettre pool (60s stale-connection timeout) + resend button feedback - #108

Merged
argszero merged 1 commit into
mainfrom
fix/smtp-pool-resend
Aug 21, 2026
Merged

argszero merged 1 commit into
mainfrom
fix/smtp-pool-resend

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Fixes intermittent 60s SMTP timeouts on verification-code sends (resend button appeared unresponsive). Root cause per host test: lettre's pool feature makes SmtpTransport::relay(...).build() reuse pooled connections — after the SMTP server (Gmail) closes an idle connection, the pool hands out the stale connection and the send hangs 60s (Kind(TimedOut)).

  • Cargo.toml: drop lettre pool feature — each send() now opens a fresh connection. Code sends are rate-limited (60s per recipient), so a pool provides no benefit here.
  • mail.rs: explicit 15s SMTP timeout so a send can never hang the full default 60s.
  • ui (app.js/i18n.js): resend button now shows Sending… and is disabled while sending, restoring its text afterwards — the silent 60s feedback gap is eliminated. Success/error toasts already existed (verify.sent / mapped error).

Related Issue

Host bug report rant 2026-08-21T14:08:03 (project: aitokenpool) — no GitHub issue number.

Changes

  • Cargo.toml / Cargo.lock: lettre pool feature removed
  • src/mail.rs: 15s SMTP timeout
  • ui/js/app.js: resend button sending-state feedback
  • ui/js/i18n.js: new verify.sending key (zh/en)

Tests

  • cargo test — 132 passed; 0 failed
  • cargo fmt --check — pass
  • cargo clippy --all-targets — no new warnings
  • node --check on modified JS files

Checklist

  • Branch naming matches convention (fix/...)
  • Conventional Commits message
  • Single responsibility, minimal diff (5 files, +9/−3)

…TP timeout + resend button feedback

Rant 2026-08-21T14:08:03: verification-code resend intermittently hung
60s — lettre pool reuses connections dropped by the SMTP server (Gmail
closes idle connections), causing Kind(TimedOut).

- Cargo.toml: drop lettre 'pool' feature — each send opens a fresh
  connection (code sends are rate-limited 60s, no pool needed)
- mail.rs: explicit 15s SMTP timeout so a send never hangs the full
  default 60s
- ui: resend button shows 'Sending…' + disabled while sending, restores
  text after (silent 60s feedback gap eliminated); success/error toasts
  already present
@argszero
argszero merged commit 50eb730 into main Aug 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant