Email to XMPP bridge "milter-xmpp" released

May 26, 2020 

We have used XMPP (Jabber) for our internal discussions for years. In the recent years it seems that XMPP has lost some of its traction. For example, Google and Facebook used to use XMPP for instant message and Slack used to have an XMPP bridge in their service. All of those are now gone and have been replaced with proprietary messaging protocols. In the context of a big company having all the control over the protocol probably makes sense, but it of course makes life difficult for users who have to have a separate client for each or have to use a multi-protocol client such Pidgin just to keep their sanity. And none of the big players seems to "winning the war" for users.

In the context of monitoring systems support for XMPP alerts is spotty. For example LibreNMS has a wide variety of alert transports, but XMPP/Jabber is not among them. However, all monitoring systems support email alerts. The problem with email, though, is that getting it to its destination can be very tricky. So, that gave us the idea to develop a general purpose "email to XMPP bridge" which could be utilized with any monitoring system to forward alert emails via XMPP.

The solution we came up with was to use milters to convert emails into XMPP messages. A milter ("Mail Filter") is a protocol for writing extension for sendmail and postfix mail transfer agents (MTAs). A typical use-case for milters is spam filtering: before an email enters the delivery queue it is passed on to the configured milters (if any) which can inspect and/or modify the email at various protocol stages of the SMTP conversation using callback functions. The callback functions can reject the message or pass it through the milter. In the case of our email to XMPP bridge we just let the emails pass through our milter, but gather data (e.g. email headers and the body) about them and send reformatted messages to the XMPP server.

The script we wrote is called milter-xmpp and it is available on GitHub. I builds on top of pymilter and xmpppy libraries. We also wrote a Puppet module for managing milter-xmpp. There are some rough edges here and there, but it does the trick for us and we would love to have others participate in its development!

Samuli Seppänen
Samuli Seppänen
Author archive
menucross-circle