B
B
BonBon Slick2021-04-01 15:26:13
Software design
BonBon Slick, 2021-04-01 15:26:13

Designing an Email Newsletter Module?

  • Newsletter is a separate localized entity. Translations of the news will be sent to everyone who is subscribed to the news in the region with such a locale, for example, the user subscribed from the ru segment, we send him a ru translation if any. Content content, email template, email title, etc.
  • NewsLetterCategory or NewsLetterTag? For example Security, Sale etc? It is unlikely to contain the SecuritySalte tag. But which tag should you use when a BlogPost contains multiple tags?
  • NewsLetterSubscription - contains the user's email and only, it is necessary to enable both anonymous and authorized users to subscribe. For example, make joinColumn = nullable on the user table in RDB.
  • UserNewsLetterSettings - set what type of notification to send to email
  • Notification - different type
  • NewsletterNotification - notification type that contains information about the Newsletter
  • BlogPost - when a notification is sent, the post has a "Notify newsletter feed" checkbox
  • EmailTemplate - editing and applying the template in different types of notifications
  • EmailVariable - available variables in the template


When a blog post is created, we create a notification and save it.
The create event triggers the creation of a notification of the NewsletterNotification type.
When a notification is created, another listener causes the notification to be sent by its NewsletterNotification ---> EMAIL type. In which we use EmailTemplate for the email template and EmailVariable for parsing the email parameters.
In this case, the localized content of the Newsletter contains the BlogPost, as well as additional parameters such as the title of the email, from whom, NewsLetterTag, and so on.
The notification has been sent to all emails specified in the NewsLetterSubscription. UserNewsLetterSettings is responsible for adding or removing NewsLetterSubscription for authorized users.
This approach requires the implementation of additional modules such as notifications, settings, email templates NewsLetterCategory and NewsLetterSubscription are actually included in the Newsletter module.
It is also possible NewsFeed, where all notifications of the type of certain types will arrive, for example, NewsEvent, while I'm thinking about it.
Naturally, you can create a Newsletter separately.

Previously, I did the implementation of news through the usual CRUD, where we have only 2 Newsletter and NewsLetterSubscription entities. The admin drives in non-localized content, then click, and everything is sent. The template, configs, etc. are all hardcoded.

Your opinion? Missed nothing? Throw UML here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question