Reputation: 373
I need to send like 4000+ emails but individual emails to each using. Doing a foreach takes forever and the page loads until it finish (What really end up doing is an error).
I need to send those emails the best way possible and just leave the job in the background and return a response while that is happening.
If I didn't explain myself correctly, let me know.
Thanks a lot!
Upvotes: 0
Views: 2804
Reputation: 3704
If you are looking for the best way to sending emails, I would highly suggest using a third party service.
There are many email services that guarantees sending your emails accurately to receivers inbox. Emails we send from our own email services provided by hosting providers mostly wind up in receivers spam folder. And also queuing up that much emails is not a solution as it would also bring up the question of what would happen if queue service failed.
I recently worked with a useful service which is named sendgrid. It helped me send that much emails without that much trouble.
You only need to loop though your data to format recipient and email content. Then send that data to sendgrid and they handle the emails.
refer this for more info.
Upvotes: 1