Skip to content
Tech News
← Back to articles

Hanami 3.0: In Full Bloom

read original more articles
Why This Matters

Hanami 3.0 introduces significant enhancements to the Ruby framework, notably integrating first-class mailers, internationalization, and Minitest support. These features improve developer productivity, application performance, and expand the framework's capabilities for building scalable, internationalized apps.

Key Takeaways

From the very beginning we set out to make Hanami a different kind of Ruby framework: clear, modular, and built to grow. Today it comes into full bloom. We’re thrilled to share Hanami 3.0 with you!

This release rounds out the framework with three big new features: mailers, internationalization, and Minitest. On top of that, your apps are now faster by default, and your developer experience is sharper, from your logs all the way to your assets.

First-class mailers

Our long lost gem is back! Hanami apps now come with integrated mailers, which feel right at home next to your actions, views, and operations.

Mailer classes describe everything you need to deliver an email:

module Bookshelf module Mailers class Welcome < Bookshelf :: Mailer from " [email protected] " to { | user : | user . email } subject { | user : | " Welcome to Bookshelf, #{ user . name } ! " } expose : user end end end

As standalone objects, mailers are injectable via the Deps mixin and accessible wherever you need them. Call .deliver and the mailer will use your input to prepare headers and render mail body templates, which work as a fully featured extension of your view layer.

Mailers support multiple delivery methods. SMTP delivery works out of the box: populate some env vars for your SMTP host and you’re good to go. In test, your emails are accumulated in memory for you to inspect.

If you need something more, you can also write your own delivery methods. In addition to a clean interface for these, Hanami Mailer provides hooks for threading delivery options all the way through your mailers, allowing new delivery methods to make the most of special features offered by email delivery providers.

Like all our gems, Hanami Mailer is also designed for standalone use. Check out the comprehensive README for everything you need to know about using it in your Ruby app.

... continue reading