Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pag66's avatar
Level 5

send email notification base on date

Hello I making an appointment module, and I want to send an email notification 12 hours before the appointment, how i could make that, the date and the hours is store as an event on the agenda, but I can't figure it out how to send the emails plese give me a hand. Im unsing laravel 5.2 Thank you.

Greetings

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

If its a one-off event, have a 'notified' flag

every 5 minutes check for appointments that are less than 12 hours away and that are not notified.

Send the notification and set the notified flag.

Use Carbon to take 12 hours off the appointment time and then check if it is in the past and un-notified (or add 12 hours to the current time then pass that to an eloquent query)

Use the scheduler to run the task every few minutes

You may also need to cope with timezones, else store everything in UTC and convert when displaying.

1 like
pag66's avatar
Level 5

Thanks a lot, that's exactly what I need, know I'm using commands and schedule, every day I feel more happy to use laravel. Thanks as alway s @Snapey

Greetings

Please or to participate in this conversation.