# Icinga in Docker: which eMail client to use for notifications?

**URL:** <https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472>\
**Category:** Icinga 2\
**Tags:** notifications, icinga2\
**Created:** [January 14, 2021, 5:50pm UTC](https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472 "2021-01-14T17:50:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Al2Klimov](https://community.icinga.com/user_avatar/community.icinga.com/al2klimov/32/959_2.png) [@Al2Klimov](https://community.icinga.com/u/Al2Klimov)\
**Post date:** [January 14, 2021, 5:50pm UTC](https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472/1 "2021-01-14T17:50:26Z")

</div>

Hi there!

@mcktr [requested](https://github.com/Icinga/docker-icinga2/issues/41) the ability to send notifications via eMail from our Icinga 2 Docker image. There’s one problem: the container runs only Icinga 2, so even if one wouldn’t use a public MTA, but a local one, it would be an extra container – and over the network anyway.

As I’m not _very_ familiar with server MUAs, so I need your help: What program you’d expect behind `mail` in the container **and why exactly**? Requirements:

- Non-127.0.0.0/8 MTA can be specified easily, preferably via a mounted `.PROGRAMNAMErc` or env vars (may be specified at Docker level as Icinga 2 [passes](https://github.com/Icinga/icinga2/blob/d82e4987bd4f1743abba46b96cd41e57221c41e9/lib/base/process.cpp#L112) its own env to subprocesses)
- [These ones](https://github.com/Icinga/icinga2/tree/d82e4987bd4f1743abba46b96cd41e57221c41e9/etc/icinga2/scripts) have to still work

Best,  
AK

---

<div class="post-metadata">

**Author:** ![dgoetz](https://community.icinga.com/user_avatar/community.icinga.com/dgoetz/32/917_2.png) [@dgoetz](https://community.icinga.com/u/dgoetz)\
**Post date:** [January 14, 2021, 9:04pm UTC](https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472/2 "2021-01-14T21:04:18Z")

</div>

What you would need here is a sendmail compatible solution that directly sends to a mail relay instead of the local mta. I have no preference here, but I have seen [esmtp](http://esmtp.sourceforge.net/), [ssmtp](https://github.com/solbu/ssmtp) and [nullmailer](https://github.com/bruceg/nullmailer) in action in different environments. I would investigate which one is easiest to install and configure so passing config to the container is as simply as possible, but there could also be other things to consider.

---

<div class="post-metadata">

**Author:** ![mcktr](https://community.icinga.com/user_avatar/community.icinga.com/mcktr/32/856_2.png) [@mcktr](https://community.icinga.com/u/mcktr)\
**Post date:** [January 19, 2021, 3:14pm UTC](https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472/3 "2021-01-19T15:14:47Z")

</div>

Hi,

I just saw that `postfix` is installed in the container.

> <https://github.com/Icinga/docker-icinga2/blob/68036a12182f7e7c047a9fd67714187bcb263169/deps.Dockerfile#L62>

But for my understanding the `postfix` daemon is not usable since the container runs only one process: the Icinga 2 daemon, correct?

For me ssmtp or. msmtp looks promising, no running daemon is needed.

(german blog post)

> **[Mailversand mit PHP aus einem Docker-Container | kuerbis.org](https://www.kuerbis.org/2018/05/mailversand-mit-php-aus-einem-docker-container/)**
>
> Vorstellung einer einfachen Lösung für den Mailversand aus einem Docker-Container heraus - dabei sind: PHP, WordPress und sSMTP.

Unfortunately the ssmtp debian package is currently unmaintained, msmtp looks like an alternative.

> **[sSMTP - Debian Wiki](https://wiki.debian.org/sSMTP)**

  

> **[msmtp - Debian Wiki](https://wiki.debian.org/msmtp)**

Both provide a symlink for `sendmail`, so sending E-Mails using `mail` should work.

Best regards  
Michael

---

<div class="post-metadata">

**Author:** ![Al2Klimov](https://community.icinga.com/user_avatar/community.icinga.com/al2klimov/32/959_2.png) [@Al2Klimov](https://community.icinga.com/u/Al2Klimov)\
**Post date:** [February 4, 2021, 6:17pm UTC](https://community.icinga.com/t/icinga-in-docker-which-email-client-to-use-for-notifications/6472/4 "2021-02-04T18:17:40Z")

</div>

Unfortunately esmtp seems not to be maintained anymore, nullmailer seems to require a service and ssmtp seems not to be compatible with GNU mail which is expected by Icinga 2’s mail scripts. But thank you for the tips anyway!
