Reputation: 22674
I plan to send an excess amount of emails daily to my website users. I am using php. Will such a task affect the performance of my website? What can be done to prevent issues?
Note: Emails are sent with users consent and scheduled by them. No spamming.
Upvotes: 0
Views: 144
Reputation: 1954
Instead of sending the email directly, why not create a database table to store the email details. and just write to that table each time you need to send an email.
Then have a scheduled task that occasionally queries this table and do the mail sending.
That way, you do not need to worry about the php page timing out. and in future, you can also pull the schedule task out and run it on a separate server if it uses too much resources.
Upvotes: 4
Reputation: 3550
My suggestion and the way we handle this is to utilize a message queue, we currently use Zend Frameworks Package, then from a cron job retrieve the queue and send the email. This enables us to increase performance and avoid delays in displaying the page to the user. Hope that helps!
Upvotes: 1
Reputation: 2447
Some off the top of my head:
Upvotes: 3