The browser will hang up when sending newsletter through smtp mail using php. The newsletter data and the recipients also bit larger. Please help to solve this issue.
2 Answers
The best way to solve this issue is to pull that task in another process. And not to send the emails in the same request.
So your page where you send the newsletter will only give the command to send them and another skript will send them in the background.
Its called the queueing approach. Look here for more informations about running asyncronous php tasks. Run PHP Taks asynchronously
While I absolutely agree with @Reflic's answer, and I would also use this approach, I mention a bit more simple way, which works better eg. on shared hosts.
You can create a cron job for this. I assume you have some sort of database. When a mail is sent, log it to the database. Run your cron job eg. once in five minutes and send a small number of mails to some of the recipients who you didn't send before (and log it). Make sure that a cron job only starts when an other finished, so give enough time to your jobs. The time they need is basically depends on how many mails do you send at the same time.
This works on any shared host, but if you have more control over the server, choose the above mentioned answer.

- 1,032
- 8
- 19