The Problem

The system needs to send daily emails to its users according to some complex criteria. How do we implement this?

The Solution

The cron job hits daily our system. At such time, the system will call the handler method of the Daily Notification Layer.

The Implementation

The Daily Notification Layer acts as the traffic controller. It controls uses three other layers of the system:

  • Daily Favorite Shop Notification fetcher. At this layer, the shops are filtered by the required criteria.
  • Daily Favorite Shop View generator. Generates responsive email view.
  • Email Api sender. Sends the emails.

Conclusion

The Daily Notification Layer retrieves all the shops, for which it needs to notify users about daily changed. For each of this shops, it generates the relevant email view from the Daily Favorite Shop View generator. Finally, it sends to all interested users, this email view.