Prompt
Should I put email sending in a background job?
Latest observation
Sep 23, 2026
OpenAI APIWeb search: off
Usually, yes — if sending email is part of a user-facing request, it’s a good candidate for a background job.
Put email sending in a background job when:
- You don’t want the user to wait on SMTP/API latency
- Email delivery can fail and be retried later
- You need to send multiple emails, attachments, or do templating
- You want better resilience if the mail provider is slow/down
Send it inline only when:
- The email is truly required before continuing the request
- You need an immediate hard success/failure result
- It’s a very small app and occasional delay is acceptable
Common pattern
- Save the important app state in your main request
- Enqueue a job with the email details
- Background worker sends the email
- Retry on transient failures
- Log failures / move to dead-letter handling if needed
Important caveat
If the email depends on database records created in the same request, make sure the transaction commits before the job runs. Otherwise the job may try to send using data that doesn’t exist yet.
Rule of thumb
If the user doesn’t need to know the email was sent right now, background job is the safer default.
If you want, I can also suggest a good implementation pattern for your stack (Rails, Django, Node, Laravel, etc.).