See the sjs-4 outbox for a concrete API.
Boomla was built with simplicity and testability in mind. Email sending fits nicely into this architecture.
Technicaly, you can not directly send emails, instead, you add emails to an outbox. Emails in this outbox are then sent after serving the response to the visitor.
More specifically, applications run in transactions and an individual outbox is created for each such transaction. When running other apps in child transactions, those transactions receive their own outboxes. When such a child transaction successeeds, its outbox is flushed onto its parent, or it is dropped entirely should it fail. This helps maintaining the guarantee that no transaction will succeed partially.
This also means that applications control the side-effects of their child transactions. This greatly simplifies testing. You can assert that the expected emails are in the outbox, and then prevent sending them.