Timeout on mail notifications

    • Adiacent srl
      Member
      # 1 year, 2 months ago

      Hello, we are testing for the first time your Notifications add-on.
      We are experiencing a problem with the number of users that should receive a notification (for instance when a new file is published): in few words we get a page timeout when the mails are sent  to a group of 10 or more recipients.
      We could change the maximum PHP script run time limit (by default 30 seconds) but it could be possible that with 200 or 300 recipients the notification process last for more than 10 minutes and obviously this is not acceptable.

      We tried to see your add-on code and we noticed that it send one mail to each user. Do you think it’s possible to change this behavior in some way? Do you have any suggestion about how fixing this problem?
      We didn’t find any trace of this problem in your forum. Maybe it could be useful find a better solution even for you.

      Best regards.

    • Thomas
      Keymaster
      # 1 year, 2 months ago

      Hi,

      in few words we get a page timeout when the mails are sent  to a group of 10 or more recipients

      I don’t think it can be an issue from our plugin since we are using the standard wp_mail() function to send emails. So I guess this might be a server PHP configuration issue 🙂

      You might probably try to increase WP memory limit, PHP memory and execution time settings, etc..

      However, the quickest way I see to solve this would be to use a SMTP plugin, so you don’t need to use PHP to send emails, but your SMTP account directly.


      Some tips to debug:

      • increase wp memory, php memory, php timeout
      • try to check your PHP logs if your see any error
      • if not, try to remove the @ before @wp_mail in file src/php/helpers/notifications-mailer-helper.class.php line 156 then try again and check your php logs again (the @ symbol prevents errors to be generated by this function)
      • go to admin > customer area > logs and see if you have the same number of notifications sent than mail received
      • you can use some WP mail logging plugin to check outgoing emails easily

      However, as stated above, I think that the most efficient way for you would be to use an SMTP plugin.

      Regards.

    • Thomas
      Keymaster
      # 1 year, 2 months ago

      Oh, and sorry, I forgot, the very first thing you should do is checking if you  have a plugin conflict.

      Best regards.

    • Adiacent srl
      Member
      # 1 year, 1 month ago
      This reply has been marked as private.
    • Thomas
      Keymaster
      # 1 year, 1 month ago

      Oooh, sorry I misunderstood you. I though you had 200 users on your site to whom you want sometimes send some notifications. I didn’t get that you plan to get 200 recipients assigned to a single private content. That’s ok, that can easily happen in some cases.

      However, thoses 200 emails being sent are differrent (because they are customized per user data). So, WP really need to send those 200 emails. But that shouldn’t be done in a single page load. This is too huge.

      In that case, you’ll need a mail queuer plugin to intercept all the emails sent through wp_mail(), and send them by small groups, so the page won’t reach the maximum allowed execution time. I can’t recommend anyone since I haven’t tested them, but we are using the wp_mail function to send emails… so that should be compatible.

      I hope that helps.

      Regards.

Viewing 4 reply threads

The topic ‘Timeout on mail notifications’ is closed to new replies.