From Action Mailer to multiple notification channels
Notifying a user about the events happening asynchronously in the system (for example, the order has been delivered or a new message has been received) is a crucial feature of most web applications. Users do not have your application open 24/7 (well, maybe some might), so you need a way to inform them.
For many years, the primary and only way of informing web application users was by sending an email. Rails has covered this use case via Action Mailer since the beginning.
Let’s do a quick tour of this Rails sub-framework.
Action Mailer in action
Action Mailer provides an abstraction to manage (route or generate) emails in a Rails application—mailers. A mailer is an object that encapsulates the generation of email messages and provides an API to deliver them. Each mailer may describe multiple kinds of related messages, usually bound by a context such as a domain model.
Let’s consider an example&...