I found few older threads that have a similar issue but most of them didn\'t have answers or if they had, the suggestions weren\'t relevant in my case.
I had a compl
One of solutions to remove waiting from client to server is to move sending emails to crontab. So when client clicks for sending, php adds email and message to queue, and then every minute you send queued messages by cron.
In addition you can add debug info into your script by having $start = microtime(true); at the top of the script and echoing echo "Line ".__LINE__.":"round(microtime(true) - $start, 3)."sec at every line.
";