Jump to content

[SOLVED] PHP mail timeout


Guardian-Mage

Recommended Posts

I am using a custom mass-emailing solution which uses PHPmailer to compose my HTML messages. I have a cron job set up to run the script every 6 minutes, and my script sends 40 emails everytime it is run. However, I am testing it by manually running it, and only sending 4 emails and it takes 20-30 seconds to run. I used set_time_limit(340); at the top of my script and at the bottom after the emails are send i use set_time_limit(20);. This is because my MySQL connection was timing out/cutting off. Still, do you know how to reduce the time it takes? I don't want my mass email to timeout when it matters.

Link to comment
https://forums.phpfreaks.com/topic/112437-solved-php-mail-timeout/
Share on other sites

I had a similar problem with a publishing system I wrote once. The script wouldn't time out but the MySQL connection would. Although there is a way to change your MySQL timeout connection, I found that it never actually worked for me. In the end I had to a kind of incremental publish where it would publish a small portion and then reconnect and publish another small portion. This would repeat untill the whole thing was published. Maybe this could work for you?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.