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

  • Home
  • SEARCH
  • 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 3693086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:20:12+00:00 2026-05-19T04:20:12+00:00

I created a Email-Queue database table. I will insert all Emails my PHP application

  • 0

I created a Email-Queue database table. I will insert all Emails my PHP application needs to send into this table.

Another PHP script will then look for all unsent Emails and sends them.

I run this script using cronjobs. Unfortunately cronjobs can run only at a maximum of once per minute.
So in the worst-case a user has to wait one minute until his Email is really going to be sent.

My current idea for a workaround is calling the script with an addtional sleep parameter and duplicating the cronjobs.

Example:

* * * * * curl emails.php?sleep=0 >/dev/null 2>&1
* * * * * curl emails.php?sleep=10 >/dev/null 2>&1
* * * * * curl emails.php?sleep=20 >/dev/null 2>&1
* * * * * curl emails.php?sleep=30 >/dev/null 2>&1
* * * * * curl emails.php?sleep=40 >/dev/null 2>&1
* * * * * curl emails.php?sleep=50 >/dev/null 2>&1

In the above example the script would run every 10 seconds. The first line of the emails.php Script would be:

sleep($_REQUEST['sleep']);
  • 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-05-19T04:20:12+00:00Added an answer on May 19, 2026 at 4:20 am

    For starters, I’d recommend using the command line version of PHP rather than using curl to call a script. You can then create a PHP script with a sensible lifetime that isn’t constrained by having to output a response within a given time period.

    As such, you can then simply sleep/check for emails/transmit/sleep, etc. within the PHP script rather than needlessly using cron.

    Additionally, I’d take care to ensure that multiple PHP scripts aren’t operating on the database table at the same time, either by using a pid file or database setting approach (if a given file/setting exists/is set, abort processing) or by sensibly timing the cron job and limiting the maximum processing time of the script by checking how long it’s been running for prior to beginning the “check for emails” portion of the cycle.

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

Sidebar

Related Questions

I'm working on a web application. A user will create an email message that
I created a new email box for general support questions. When I try to
I'm programming in PHP and would like to create web pages which have email
I created a simple .NET windows application in Visual Studio 2005 and on just
I'm working on application for tracking vehicles. There will be about 10k or more
I created a new email-message using Redemption-Data-Objects in C#. After calling Display(), the window
I have created a windows service that sends email reminders every 30 seconds. 10
I need to create an email in C# that is sent to a blackberry
How can I create an array of email addresses contained within a block of
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user

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.