Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8664665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:17:45+00:00 2026-06-12T17:17:45+00:00

I have a web app that sends customized emails to my users throughout the

  • 0

I have a web app that sends customized emails to my users throughout the day, at times they’ve selected. So at any given time of the day, I might need to do nothing, or send up to ten thousand emails.

Previously I solved this with a single cron job, firing every minute. It would call a script that would find the next thousand emails that needed to be sent. The script would mark them all as “in progress” and then loop over them, trying to send them. The loop is heavy – calling a remote API to send the email, updating the record to “sent”, logging the action. The problem I’ve found is that once in a while, the loop would break, fail, the server would blink, and hundreds of emails would get stuck marked as “in progress”.

I’ve rewritten the loop now to get a single email that needs to be sent, mark it as “in progress”, send it, mark it as “sent”, log it, and then get the next one. I run it for a minute, as many loops as it wants. But this is really cpu intensive, and seems very inefficient, with a lot of db calls.

I’m thinking now that each daily email should have it’s own cron job. Then I end up with ten thousand or more jobs calling a specific url like http://mydomain.com/email/123/send. My concern here is that I will need to update the cron jobs for things like timezones and user preference updates (“send me my email at 6PM instead of 10AM”). So I’m programmatically re-writing my crontab, and possibly often.

How would you solve this problem? As an aside, do you know of any web services designed to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:17:46+00:00Added an answer on June 12, 2026 at 5:17 pm

    It depends on your exact needs, although 10k cron jobs looks really bad, no matter what.
    Maybe you can have a few cronjobs where each picks a batch of mails to send, to achieve parallelism AND avoid delay sending the mails at the bottom ?

    Also, for the part of “programatically rewriting my cron”, there are cron libraries available. I’m usually using Quartz for this kind of thing, but it might be too bloated for your needs, so maybe you want to use a lighter library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web app that sends out emails. Currently, all emails have
I have a web app that sends messages to an Amazon SQS Queue. Amazon
I have some automated functionality built into my web app that sends email daily
I have a web app that runs fine in Visual web developer. But when
I have a web app that reads data from a SQL DB that contains
I have a web app that has a big and complex form (fields, checks,
We have an web app that is talking to Netsuite via Netsuite's web services.
I have a web app that I've recently applied a jQuery ThemeRoller theme to.
I have a web app that lets a client define a daily rate for
We have a web app that we update and release almost daily. We use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.