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 6752459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:02:50+00:00 2026-05-26T13:02:50+00:00

I am running this script it is fine for one context but when I

  • 0

I am running this script it is fine for one context but when I try this on 4 recipients it is not working just showing this error:

Fatal error: Maximum execution time of 30 seconds exceeded in D:\Hosting\8011955\html\admin\newsletter.php on line 60

How can I improve this code? I just want to send email not more than 200.

here is the code:

if(!(is_array($errors)))
{
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: \"".$from_name."\" <".$from_email.">\n";

    $query="SELECT email From newsletter WHERE visible='1'";
    $result=mysql_query($query) or mysql_error();
    while($rowdata=mysql_fetch_array($result))
    {
       $headers .= "To: \"".$to_name."\" <".$rowdata['email'].">\n";    
           mail($rowdata['email'], "$sub",$message, $headers);
    }   
}
  • 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-26T13:02:50+00:00Added an answer on May 26, 2026 at 1:02 pm

    By default, PHP scripts run for 30 seconds and then stop. This value is controlled by the max_execution_time value in php.ini. You can override this value within the current script by calling the set_time_limit() function. Each time you call set_time_limit() the script execution timer starts over at zero. So you can put it inside of your while {} loop to give your script as much time as it needs.

    while($rowdata=mysql_fetch_array($result))
    {
       set_time_limit(30); // Reset script timer and give script 30 seconds to send the next email
       $headers .= "To: \"".$to_name."\" <".$rowdata['email'].">\n";    
       mail($rowdata['email'], "$sub",$message, $headers);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This MySQL script installs multiple triggers. It works on one machine running MySQL 5.0.51b-community.
I tried running a python script: print Hello, World! And I get this error:
Hi I have the following script which works fine running on IIS but when
All PHP pages are all running just fine on my site, except for one
I have a PHP script with infinite loop. I need this script running forever.
I have this script, running on a links list: $('li#linkcat-25 a').bind('click', function (e) {
I have a Python script that is running a few ls commands. This script
This seems redundant, running perl from a Perl script itself. my $Pref = &*())(*&^%$#@!;
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
I'm working on this small script: basically it's mapping the list elements (with special

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.