0

I need to set up email notifications for a messaging system (Laravel/vue/vuex/Pusher).

I already have in-app realtime notifications, but I´d like to send reminders via email to users with unseen messages.

I am having trouble defining the logic to avoid sending spam. I do not want to send an email for every message and I also do not want to keep reminding them about the same messages.

What would be the best way to keep track of what messages I have already emailed the user about?

gia
  • 757
  • 5
  • 19
Felipe
  • 3
  • 1

1 Answers1

0

Laravel's notifications are already built to handle "unseen" notifications that can be marked as read: https://laravel.com/docs/5.6/notifications#marking-notifications-as-read

You should be able to add your own field to the notifications table that indicates whether they have been sent an email. Then set up a job to send emails out for all notifications that are still unread and haven't been sent an email.

Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95