I have a front end module designed to trigger emails daily based on a timer. The entire business logic is designed in a service module however I have to keep a front-end app as well just to be able to use the send email function. How can I design my system to be able to send emails from my backend module itself so that I don't have to keep the front-end module at all?
Hi,
There is nothing wrong with keeping a very small UI module whose sole purpose is to host the Email definitions and the Send Email logic, and call it from your service module.
Regards,
Daniel
I agree.
In terms of architecture, this "e-mail" module can be considered a core module, despite having some elements that usually are found in end-user (front-end) modules.
This would make the app in which this module is, assuming you don't have other end-user modules on it, a core application.
Cheers.
Hi Daniël, Eduardo, thank you for your reply. You are right keeping a small UI module would be the ideal solution here. Still, just out of curiosity- could there be a way to bypass using a UI module completely?
I would say that besides using the approaches provided by Nuno, the other possibility would be to use some kind of service where you could have email templates and you would call it passing the required information + which template to use + email list (sender/recipient).
I am not sure such type of service actually exists, but it certainly poses challenges (like data security, etc).
You could achieve this creating your own service in OutSystems. I forgot to mention, you don't need a UI module (like a Reactive Web module) to implement email.
You can use a blank module and add any required references (like the OutSystems UI) and have your own Theme for the email, for example.
If your email is text only, you can achieve it with a component:https://www.outsystems.com/forums/discussion/52171/is-there-any-way-to-send-mail-in-server-action-without-ui/
If you want to customize the entire HTML by hand, it can also be done, although it is not practical.
Hi Nuno, thank you for sharing this. You are right, customizing the entire HTML by hand is doable but not practical.
In OutSystems, the built-in Send Email functionality is tied to a Front-end module because email templates (Email Screen) are UI elements. A Service module cannot directly define or send emails using the traditional Send Email action.
However, there is a better architectural approaches.
Create a Dedicated Email Front-end Module
Instead of mixing email logic with your business UI, create a small Front-end module whose only responsibility is sending emails.
EmailApp (Front-end)
├── Email Templates
├── Public Server Actions
│ SendWelcomeEmail()
│ SendReminderEmail()
│ SendNotification()
└── Timer (Optional)
Your Service module simply calls:
EmailApp.SendNotification(...)