36

I want to send hundreds of emails using PHP. To increase the execution time, I used ini_set('max_execution_time', 10); but after sending just 30 emails the browser shows me a blank page and does not send all of the emails.

I also changed the limit to 300, 600 ..

Really Nice Code
  • 1,144
  • 1
  • 13
  • 22
PHP Ferrari
  • 15,754
  • 27
  • 83
  • 149
  • 2
    Watch out for web server timeout, 'cos I'm guessing you're running this via a web request; and this type of task should really be executed CLI via a cron task – Mark Baker Feb 28 '11 at 15:54

1 Answers1

43

Try set_time_limit(0); at the top of your script.

set_time_limit sets the maximum execution time in seconds. If set to zero, no time limit is imposed (see PHP manual).

Al.G.
  • 4,327
  • 6
  • 31
  • 56
Richard Pianka
  • 3,317
  • 2
  • 28
  • 36
  • Thanks, glad that i know i should place it on first invoked script. Not the second one. Kindly explain why it have to be the first? – Adi Prasetyo Nov 05 '17 at 12:59