Setup A Notification System For Labs And Home Networks

Aug 11, 2023 · 7 mins read
Setup A Notification System For Labs And Home Networks

In the video below, we show how to setup a notification system for labs and home networks

Sending and receiving alerts from IT devices is extremely important

Whether something has gone wrong or a capacity limit has been reached, you’ll want to know so that you can take action

But if you have a lab or home network, setting up your own internal email server isn’t always practical

And that’s where an SMTP gateway like Mailrise can help

You still send emails to it but it converts and forwards these on to messaging services like Discord, Pushover, Slack, etc

And this can be very useful because you won’t have to store public credentials on all of your devices that need to send alerts

Useful links:

Now because this video is specifically about setting up Mailrise, I’m going to assume you already have Docker installed or you know how to set it up

If not then I do have another video which shows you how to install that in a Debian VM running on Proxmox VE so you can get the best out of both technologies

Setup Mailrise:
One way to install Mailrise is to set this up in Docker using Docker Compose

So we’ll edit the YAML file

nano docker-compose.yml
version: '3.8'

    image: yoryan/mailrise:latest
    container_name: mailrise
      - '8025:8025'
    restart: unless-stopped
      - ./mailrise/mailrise.conf:/etc/mailrise.conf

NOTE: Adding the version and services section are only necessary when a new file is being created

We want to give this container a meaningful name, we’ll stick with the default port of 8025 and we want the service to always restart unless we’ve manually stopped it for maintenance for instance

We’ll need to configure Mailrise with details about the messaging service(s) so we bind the container configuration file to an external file we’ll edit going forward

Create Slack Account:
Now Mailrise supports a lot of services that you can forward alerts to

And for this video we’ll set it up to use Slack which is a messaging service that you can use for free

First you need to create an account, so head to the following URL and click Try For Free in the top right corner

Enter your email address and then click Continue

The login process is passwordless so check your email and use the confirmation code you receive to sign into Slack

Once you’re logged in click Create Workspace

Then give this a meaningful name e.g. Home Network then click Next

Change your user details if you wish then click Next

As this is just for alerts, you can click Skip this step then click Skip Step to confirm

You’re then asked to create a channel so enter a meaningful name for this e.g. alerts then click Next

Create Slack App:
You’ll probably see blogs and videos out there for Slack referring to Incoming Webhooks but these appear to be getting deprecated

In which case we’ll create a Slack App

To do that navigate to the following URL

Click Create an App then click From Scratch

Enter a useful name e.g. mailrise

Select the workspace that was created earlier

TIP: If the workspace you want to use is not showing, click Sign into a different workspace

Now click Create App

Create Slack Bot:
The next thing to do is to create a Bot so under Add features and functionality click Bots

Now click Review Scopes to Add

Under Scopes and Bot Token Scope click Add an OAuth Scope

Select chat:write

In the left hand pane select Install App then click Install to Workspace

Now click Allow

You’ll be presented with a Bot User OAuth Token so click Copy and paste into a text editor for instance as we’ll need to use it later

NOTE: You must keep this secret as anybody who knows this can send messages to your slack Workspace. I’ll delete the App after creating the video, so I don’t mind showing this token as an example

TIP: You can find this at a later date by selecting OAuth & Permissions in the left hand pane

Add Bot To Channel:
Next we need to add the Bot to the channel we want to receive alerts in

Navigate to your Workspace and that channel in particular, then in the message box type in @ and select the app we created from the drop down list

Hit return or click the send button then click Add to Channel to confirm

Configure Mailrise:
I want to keep my container files separated so the first thing we’ll do is to create a folder

mkdir mailrise

And then we’ll create the configuration file

nano mailrise/mailrise.conf

      - slack://mailrise@xoxb-5713301677127-5725021288613-LxQxkzpBW2arJvvHcRP5mOVf/#alerts

In the above example, the format we’re using is the name of the App, in this case mailrise, followed by @ then the Bot User OAuth Token, then a / then a # and then the channel, in this case alerts

Now save and exit

Now we can start Mailrise

docker compose up -d

To test Mailrise we’ll send it an email

By default there is no security i.e. no login credentials or a trusted TLS certificate for encrpytion but you can add these later

The email address to send emails from doesn’t really matter so it’s up to you, but you could use this as a way to identify the alerting device

The destination address, however, should include the service you want to use followed by the domain name

Unless you define a domain name in the Mailrise configuration file, this defaults to

So to send an alert to pushover for instance, the destination email address would be

In our case we’re using Slack and so this should be

Bear in mind that the server listens on TCP port 8025 rather than the usual port 25

One way to test this on a Windows computer is to use Powershell, for example

send-mailmessage -from "admin@homelab.local" -to "" -subject "Windows Test" -body "Test message" -smtpserver -port 8025

Although you’ll need to at least replace server IP with what’s relevant for you

NOTE: The command can be restrictive on the domain name. For instance, homelab.lan isn’t accepted but homelab.local is

An option for Linux users, if you don’t want to install additional software is to use Telnet, for example

telnet localhost 8025
HELO homelab.local
mail from:admin@homelab.local
from: admin@homelab.local
subject: Linux Test
Test Message

For this example I used the Linux computer running Docker and thus Mailrise and so can reference it as localhost

In the example data I didn’t specify the email recipient as it doesn’t matter, but I did include the email address this is being sent from because without it, the alert would show up as from No Sender

Now the beauty of this setup to me is that there isn’t much to configure and it should be easy to backup and restore

But once Mailrise is up and running, you can now point most applications and devices to this SMTP gateway to receive alerts

Better still, you’ll be able to receive these on an App which should be easier to find than if your were sending them to a general email account

Now there are lots of alternative services to Slack you can use, but for me at least it’s free and comes with a 90 day history limit, and as alerts are meant to be acted on ASAP anyway that’s not a problem

Just bear in mind though that by default there is no security or encryption for the emails being sent to Mailrise so it might be something you’d want to setup

Sharing is caring!