Answer the question
In order to leave comments, you need to log in
How to implement sending email for a certain period before the event?
Site on Laravel. I use queues to send email. Beanstalkd queue driver.
Task: The user creates an event on an arbitrary date and can indicate that he wants to be notified n times before the event occurs.
There are no problems here, we calculate the delay and put the task in the queue.
The problem occurs when a user edits an event or an alert period. You need to edit the task in the queue or create a new one.
Can you tell me the best way to do this?
Answer the question
In order to leave comments, you need to log in
Because the queues are a little not made for this.
You need a cron task.
Queues are needed in order to carry out heavy operations in the background.
Like generating a report, sending an email right away, etc. So as not to delay the script.
If you want queues, you can pervert.
Make a cron task that will check events every 10 minutes and add emails to the queue for the near future :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question