Sorry about my english - if some thing is not clear please ask me in comments - i will clarify this.
I build system in microservice architecture. I have one service with user information, one service for "offers", and one service for "ideas". Services "offers" and "ideas" comunicate (by Restful API) with "User" service on login and other operations. And i wonder - how to deal with emails? Each service have it separate frontend and send emails after some actions (eg. when some third person open link with some offer the user who create this offer will get email, or when some user create idea the manager will get email). Moreover, on each service frontend, manager can create "periodic" mailing with season statistical data or just some other information. Each service email looks differently and have different content.
I have many choices and don't know which will be better. This are some propositions:
- Each service has his own separate emailing system and send all kinds of email (after action, and periodic) independent.
- The "user service" have "engine" to send action and periodic emails and other services give the task. Inside task there is link to service who give task and that link will generate email content (for example witch statistical data in periodic email). This solution is complicated...
- The "user service" has only engine to periodic emails (tasks have link to generate email body...) but email after actions are send from each microservice indepenndent
- Create new microservice only for sending email (periodic and "after action") with proper API. Ofcourse each service like "offers" should send also link (to themself) in mailing task - this link will be call when the periodic email will be send and the response of this link will be generated body of email....
Which one will be better? Or may be there is some better alternative?