K
K
Konstantin Eliseev2019-05-31 14:40:09
Laravel
Konstantin Eliseev, 2019-05-31 14:40:09

How to make a mailing list with a limit on the number of letters in Laravel?

I'm trying to make a newsletter about new announcements.
- 1000 addresses
- smtp limit 30 emails/minute.
Laravel has queues - their main goal is to be able to re-execute if something goes wrong. It’s better not to load all 1000 tasks into the queue for sending emails right away due to restrictions.
1) Of course, there are all sorts of sleep, delay(now()->addMinutes(10)), Mail::later($when, new OrderShipped($order)) and other methods - but do they all load PHP during idle time?
2) You can immediately load all 1000 messages into the queue, but most of them will not be sent and you will have to resend them later.
3) Therefore, it will be most optimal to write the code in such a way as to add 20-30 letters to the queue per minute due to the cron task. Well, then the queue is sent out.
Tell me, did I figure it out correctly or is this splitting into small packets for sending not necessary and can I somehow regulate the number of tasks performed (sent letters) using some settings?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-05-31
@K0r5hun

1) Of course, there are all sorts of sleep, delay(now()->addMinutes(10)), Mail::later($when, new OrderShipped($order)) and other methods - but do they all load PHP during idle time?
No, they don't load.
You got it wrong. I recommend re-reading the queue documentation thoughtfully. The most difficult way is Rate Limiting .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question