# Hanami 2: mailer or mail gem

**URL:** <https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100>\
**Category:** questions\
**Created:** [January 14, 2025, 2:24pm UTC](https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100 "2025-01-14T14:24:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![svoop](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/svoop/32/443_2.png) [@svoop](https://discourse.hanakai.org/u/svoop)\
**Post date:** [January 14, 2025, 2:24pm UTC](https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100/1 "2025-01-14T14:24:07Z")

</div>

Doing stuff with emails has always been a peculiar kind of fun and as [splitting the email atom](https://portswigger.net/research/splitting-the-email-atom) demonstrates, even more so when using emails for auth.

Being restrictive and always up-to-date on versions therefore are key, but looking at `hanami/mailer`, a bit of dust has settled on it, the dependency on `mail` is nailed to ~2.7.

I guess, `hanami/mailer` will eventually join the Hanami 2 set of gems, however, I’m wondering whether this will rather be an evolution or a rewrite (from an API point of view). Or in other words… What’s probably the better approach when only sending simple, transactional mails on Hanami 2 today: Just rely on the `mail` gem directly or use `hanami/mailer` to be ready for it’s version 2?

Cheers! -sven

---

<div class="post-metadata">

**Author:** ![katafrakt](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/katafrakt/32/735_2.png) [@katafrakt](https://discourse.hanakai.org/u/katafrakt)\
**Post date:** [January 16, 2025, 11:17am UTC](https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100/2 "2025-01-16T11:17:42Z")

</div>

`hanami/mailer` works with Hanami 2, at least the `master` version. You can use it. It’s quite thin wrapper over `mail` gem and I suspect you would end up with more or less the same with writing your own support for `mail`. At least that’s my (quite limited) experience with it.

---

<div class="post-metadata">

**Author:** ![runlevel5](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/runlevel5/32/827_2.png) [@runlevel5](https://discourse.hanakai.org/u/runlevel5)\
**Post date:** [March 10, 2025, 10:54pm UTC](https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100/3 "2025-03-10T22:54:49Z")

</div>

Ah it brings back memory. The `hanami/mailer` is basically just a thin wrapper around `mail`. I highly recommend you start with `hanami/mailer` simply because it  
would integrate a bit better to the hanami convention. If you happen to find any particular pattern or feature that mailer lacks, feel free to bring up the  
discussion here.

---

<div class="post-metadata">

**Author:** ![swilgosz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.hanakai.org/swilgosz/32/484_2.png) [@swilgosz](https://discourse.hanakai.org/u/swilgosz)\
**Post date:** [March 12, 2025, 7:06pm UTC](https://discourse.hanakai.org/t/hanami-2-mailer-or-mail-gem/1100/4 "2025-03-12T19:06:31Z")

</div>

For anyone who needs this, I have recorded an episode how to integrate hanami-mailer in hanami apps (quite early versions of hanami 2)

> **[Send emails with hanami-mailer](https://hanamimastery.com/episodes/47-send-emails-with-hanami-mailer)**
>
> Sending emails in web apps is a very common task. In this video, I'm going to send a contact email using hanami-mailer gem.

I haven’t revisited it for a while but the idea of how to use it remains the same.

Hope this will be helpful to you!
