Email Operations
Why Email Sending Systems Need Retries
Published 2026-09-20 · CSV Sender
CSV Sender classifies Gmail errors, retries up to five times with exponential backoff minutes, and reschedules rows to SCHEDULED with next_retry_at.
Quick answer
Email send retries in CSV Sender use computeNextRetry in lib/sending/retry.ts. Retryable errors (rate limits, transient network/5xx) reschedule the message to SCHEDULED with next_retry_at and increment retry_count until MAX_RETRIES (5). Auth, invalid recipient, and permanent errors stop immediately as FAILED. Backoff minutes grow exponentially (rate limits start at 30-minute base, transient at 5, others at 15) capped at 24 hours.
Retry decision flow
- Worker claims due message → SENDING
- Gmail send throws
classifySendErrordetermines class- If invalid/permanent/auth → terminal FAILED
- If retry_count ≥ 5 → terminal FAILED
- Else compute delay → SCHEDULED with
next_retry_at
Successful sends clear next_retry_at on SENT.
Rate limits vs campaign pacing
Campaign daily email sending limit prevents self-inflicted bursts; Gmail may still return 429. Retries backoff longer for RATE_LIMIT class—combine with lowering caps (Gmail sending limits for CSV).
Auth failures
AUTH class does not retry—Gmail account status becomes REAUTH_REQUIRED so operators fix OAuth before new attempts (Gmail OAuth for email sending). Existing FAILED rows remain until handled (email status failed).
Idempotency
Updates use conditional .eq("status", "SENDING") to avoid double-send if two workers raced—security and reliability detail on /security.
Suppression before retry
Each attempt re-runs suppression check—address unsubscribed during backoff skips as UNSUBSCRIBED without further retries (email suppression list).
Observability
Activity message_send_failed logs metadata; message row retains truncated error message for support (workspace email history).
Example timeline
Row hits transient 503: retry 0 → +5 minutes; retry 1 → +10; … until success or fifth failure → FAILED. Row hitting 429 might wait 30, 60, 120 minutes between attempts.
FAQ
Can I configure MAX_RETRIES?
Fixed at five in code—reduce Gmail stress via campaign limits instead.
Do retries duplicate emails in Gmail?
Only one successful SENT per message id when idempotent updates succeed.
Are SKIPPED rows retried?
No—retries apply to send errors (failed vs skipped email).
Does cron frequency affect retry timing?
Claims depend on next_retry_at due time and cron schedule (campaign send worker).
Where is retry logic documented for security review?
See product security page and bounded backoff in retry helper.
Related reading
Tuning campaign limits with retry behavior
Retries extend campaign calendar length—if many rows sit in SCHEDULED with future next_retry_at, completion dates slip (calculate email campaign duration). Lower daily limits proactively when Gmail returns rate errors to reduce retry churn.
Security reviewers should note retries still pass suppression checks and idempotent SENDING guards—documented on /security alongside cron authentication via CRON_SECRET for the worker (campaign send worker).
After outages, inspect FAILED rows that exhausted retries versus those that recovered to SENT—both appear in workspace email history.
Backoff math operators should know
First retry delay depends on error class—rate limits wait longer than generic transient blips. Delays double with retry count until the 24-hour cap. Five failed attempts mean the sixth decision is terminal FAILED—plan human intervention before that point (email status failed).
Production send discipline
Treat each CSV upload as a production release: freeze copy, validate structure, dedupe recipients, sync suppression, preview representative rows, and only then set campaigns RUNNING. CSV Sender’s model—prepared email, subject, and body columns, paced scheduling, workspace-level opt-outs, duplicate guards, and bounded Gmail retries—rewards teams that invest in export quality upstream rather than debugging merge tokens downstream. When results look wrong, start from message statuses and skip reasons before blaming Gmail; most surprises trace to data preparation (validate CSV before emailing), list hygiene (remove duplicate emails from CSV), or sender OAuth (Gmail OAuth for email sending). Revisit scheduling articles if timing—not content—is the issue (schedule emails from CSV).
Production send discipline
Treat each CSV upload as a production release: freeze copy, validate structure, dedupe recipients, sync suppression, preview representative rows, and only then set campaigns RUNNING. CSV Sender’s model—prepared email, subject, and body columns, paced scheduling, workspace-level opt-outs, duplicate guards, and bounded Gmail retries—rewards teams that invest in export quality upstream rather than debugging merge tokens downstream. When results look wrong, start from message statuses and skip reasons before blaming Gmail; most surprises trace to data preparation (validate CSV before emailing), list hygiene (remove duplicate emails from CSV), or sender OAuth (Gmail OAuth for email sending). Revisit scheduling articles if timing—not content—is the issue (schedule emails from CSV).
Related articles
Email Operations
What Does Failed Mean When Sending Email?
FAILED means Gmail send exhausted retries or hit a non-retryable error such as invalid recipient or auth—inspect error_code and reconnect OAuth.
Email Operations
What Does Scheduled Mean in an Email Queue?
SCHEDULED rows have scheduled_at or next_retry_at and are eligible for the worker claim_due_messages RPC when campaigns are RUNNING.
Gmail
Gmail Sending Limits: What CSV Senders Need to Know
Official Google limits for consumer Gmail and Workspace, how CSV row sends count, and why quotas change over time.
Gmail
Gmail Sending Queue for CSV Campaigns
Sequential row processing, pause/resume, and throttling between Gmail API sends from a prepared CSV.