Bulk send architecture

  1. Validate campaign status (DRAFT or SCHEDULED).
  2. Resolve recipients: combine EmailList members + segmentQuery tags.
  3. Chunk recipients by MAILGUN_BATCH_SIZE (default 500).
  4. For each chunk, call Mailgun API; on 200, mark each CampaignLog row sent=true, sentAt=now().
  5. Between chunks, setTimeout(batchDelayMs) (default 1500ms) — keeps under 300 msgs/sec.
  6. Update Campaign.totalRecipients after enumeration; transition Campaign.status to SENT when done.
  7. Failures (4xx/5xx): log CampaignLog.errorMessage, leave row sent=false; retried by next scheduled run.

Per Mailgun docs, 300 msgs/sec is the safe ceiling for shared IPs; 500/batch @ 1.5s spacing (~333/s) sits just under that.

Choose Theme

Your selection is saved locally.

Neural Cacophony
Aperture v2
Flux v1
Mosaic Chaos
Nexus v1
Nexus Zest
Prism v2
Synapse