I am looking for an advice on how to implement the structure of solution/projects.
Currently, (written in .Net Core 2.0) I have a Web API project which is the main project. Then there is DAL (for accessing the database), BusinessLayerproject and an authentication server project.
The whole stack is to be run in a Linux environment.
I am looking for a way to add mail sending logic to the above solution. There are 2 cases:
- (Active) Send notification when a new user is registered or a password reset is triggered (via
Web API) - (Passive) Send out monthly statistical data to users / send out recurring notifications (via ???)
Now, if this solution was to be deployed on Windows - I would have created a new WindowsService project to send out passive notifications + added a mail sender service to Web API project. But now that the Linux is used, I am running out of options.
My current planned approach is following:
- Inject MailSender service into
Web APIcontroller to send out active notifications. - Add a new
Consoleproject, to send out recurring notifications (passive ones). - Add a
crontabentry inLinuxfor the above mentioned console program, with a given time interval/delays. It will launch console app and execute mail sending for passive notifications.
Before I dig too deep into this - is there any better solution? Or is my proposed solution any good?
Worth saying, that I am planning to use Razor templating for mails. So whatever the project is going to be used - it needs to support that.