Limit e-mail flow in Laravel
Asked Answered
D

1

2

I'm working on an app built with Laravel 4.2.

My app will send a pretty large amount of individual emails. The problem is that my SMTP server has a limit of max 300 mails/30 minutes and 5000 mails/day

That will be enough for me. But I would want to control the flow of sen email by queuing them up to be sent at a rate of max 300 mails/30 mins.

Is there a simple way of doing that, using Laravels libraries?

Dabber answered 1/6, 2015 at 7:38 Comment(2)
I found this article interesting: camroncade.com/…Krystakrystal
The same question is over here, and I just answered it: https://mcmap.net/q/955364/-laravel-email-with-queue-550-error-too-many-emails-per-secondKrystakrystal
B
1

You're on the right track with the queue. Say you had a DB table with one row for each email to be sent, and a column tracking if that email has been sent. You could create a Laravel Command that would be executed as a cronjob every 30 minutes that would send the next 300 emails that have not yet been sent.

A better, cleaner and all around more scaleable option would be to implement one of the many queue engines supported by Laravel's Queues. This will require modification of the server environment much like installing mysql to support the database.

Blaeberry answered 1/6, 2015 at 18:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.