I recently discovered Mailrise, which is an SMTP gateway for Apprise notifications. You can use Mailrise to have devices that only use SMTP for notifications or alerts, and Mailrise will convert it to one of the many supported notifications found here.
In this post, I will be configuring it with Signal. To deploy Mailrise with Signal, I will be using an LXC container on a Proxmox server running Debian (I am using a template I created that has docker preinstalled. Instructions to install it can be found here).
A brief overview of what we need to do is found below.
- Deploy the Signal REST-API docker image found here. You can find the setup instructions on the apprise documentation page found here.
- Link your Signal account to the Signal REST- API docker image.
- Generate a
mailrise.conf
file. - Deploy Mailrise with docker-compose
Signal
First, make a directory that will hold the docker-compose files. I will be using the /opt/docker
directory. You will need elevated privileges to create the directory if you are not running as root.
- If you are not running as root, you will need to change the ownership of the
/opt/docker/
folder. You can do this by usingsudo chown -R <user>:<user> /opt/docker/
. Change the<user>
to your username.
You can run this with docker as shown in the Getting Started page of the project's README here. I prefer to use docker-compose as I can see the configuration that I used to deploy the container.
Next, create the docker-compose.yml
file for the Signal REST-API docker image.
nano /opt/docker/signal-rest-api/docker-compose.yml
Bring up the container by running the docker-compose -f /opt/docker/signal-rest-api/docker-compose.yml up -d
(Or docker-compose up -d
if you're in the directory where the docker-compose.yml
file is located).
Register your Signal number by going to http://10.0.69.1:8080/v1/qrcodelink?device_name=signal-api
. Replace 10.0.69.1
with the IP address of your machine. You can link your number by going to the Signal app > Settings > Linked Devices.
Mailrise
To deploy Mailrise, make a directory in the /opt/docker
directory.
Then create the docker-compose.yml
file in the /opt/docker/mailrise
directory using nano
.
Before deploying the container, you will need to create the mailrise.conf
file. The docker-compose.yml
file sets the location of the mailrise.conf
file in the same directory as indicated by the ./
in the last line of the configuration file.
Note: If you don't create the file, a directory will be created when the container is deployed. You'll need to remove the folder and create the file.
nano /opt/docker/mailrise/mailrise.conf
Note: Modify the signal://
lines to reflect your IP address and Signal recipient and destination phone number. You can also choose if you want to send a message to yourself or to another Signal number.
In the mailrise.conf
file shown above, there is a section for signal
and another section called jamesjonahjameson
. These can be used to have different email recipients so that when you send an email to signal@mailrise.xyz
, you get a signal Note to Self. When you send an email to jamesjonahjameson@mailrise.xyz
, someone else gets notified.
There are several urls
you can add to the config file, such as Microsoft Teams, PagerDuty, Home Assistant, Mastodon, PushBullet, Pushover, and so many more. You can find a list of all the supported notification services here.
After you configure the mailrise.conf
file, bring up the container with docker-compose -f /opt/docker/mailrise/docker-compose.yml up -d
(Or docker-compose up -d
if you're in the directory where the docker-compose.yml
file is located).
Verifying installation
You can verify the docker containers are running by executing docker ps
.
Note: If you have any errors running a container, you can check the logs by runningdocker logs <container_name> -f
. You can also rundocker-compose logs -f
if you are in the directory where thedocker-compose.yml
file is at.
An example of the directory structure can be found below (You can run tree /opt/docker/
to check your file structure).
[user@fedora ~]# tree /opt/docker/
.
├── mailrise
│ ├── docker-compose.yml
│ └── mailrise.conf
└── signal-api
├── docker-compose.yml
└── signal-cli
Using Mailrise
There are several ways you can use Mailrise to send notifications.
Linux
In Linux, you can use ssmtp
to create an email from the command line.
After installing ssmtp
, modify the /etc/ssmtp/ssmtp.conf
file to have the following
Now that the configuration for ssmtp
is done, you can send a message by executing the following:
echo "Current Directory is $(pwd)" | ssmtp signal@mailrise.xyz
A more useful example command can be found below.
{
echo To: signal@mailrise.xyz
echo From: from_email@example.com
echo Subject: Current user is $USER
echo "Body Message goes here"
echo "You can add more info here such as the IP address"
echo "Public IP is :" $(curl ifconfig.co)
echo "Private IP is $(ip addr show eth0 | grep 'inet\b' | awk '{print $2}' | cut -d '/' -f1)"
} | ssmtp signal@mailrise.xyz
Windows (PowerShell)
In Windows, you can use the Send-MailMessage
PowerShell cmdlet (more info found here). You can add variables to receive some information about the system as well.
Send-MailMessage -From "admin@$env:COMPUTERNAME.local" -To "signal@mailrise.xyz" -Subject "subject" -Body "Machine running $env:PROCESSOR_ARCHITECTURE" -SmtpServer 10.0.69.1 -Port 8025