Previously send_email was part of CloverWeb. This makes it difficult to send an email in contexts outside of the web application. Sending mail requires setting up a whole web app, which is not a lightweight operation. The reason of putting send_email in CloverWeb was to have access to render plugin, because we need to render html pages as a part of email content. render plugin is part of roda, so it is not available outside of roda app. In this commit, I implemented a simple EmailRenderer. It is a wrapper around Tilt::ErubiTemplate, which is the same as what is used in roda's render plugin. With the new renderer, we can render templates without having to set up a roda app and send emails from any context. This also unblocks sending monthly emails for invoices.
588 B
588 B