Use catchmailnot to post mails to Discord.
I wrote a post a couple of years ago about using discord as a place to capture notifications from various things into.
It should be noted that the same technique could be used to send mail to Slack, Rocket Chat, Mattermost or teams should you want to.
What’s this ask?
Services such as papertrail or netdata send out alerts mainly using email, papertrail has a link to slack, but that doesn’t work with the fudge I noted in the past post with Discord. I’m trying to get all my notifications out of email and into Discord.
How do I get emails into discord using its web API?
What needs to be setup?
Open Discord and create a new Private chat called something (chatty n this example)
Click on the cog next to chatty (settings)
Open Integrations and click on Webhooks
Create a new Webhook and give it a useable name (and Icon if you want)
Click on save then copy the Webhook address which will look something like this.
Create an account on (free is fine) https://catchmailnot.com/ and login
On the Homepage pick the New Identifier on the left
For the free account, there are 4 mail domains you can choose, you can port over your own domain if you have a paid account.
for the sake of this exercise, it doesn’t really matter what domain you choose
you’ll notice that whatever mail address you choose (for example email@example.com) additional prefixes can also be used so firstname.lastname@example.org
Click on the choose button
Under Settings, the account will appear along with the mail account you associated your login with.
Next head to Rules & Blocks and click on Add Rule in the top right
A new Rule will be added to the rules list, click on Edit Rule.
Here we can setup the rule. I’ll use the example of papertrail which i know emails are sent from email@example.com
Fill in the rule based on the information we have
From: is the mail address the alert is coming from
Added papertrail as the prefix to keep troubleshooting easier
I’ve set the mail to forward
Provided the Discord Webhook we created earlier.
Click on Save
There is a bug here, and the rule will not show by default, you need to select another option on the menu to the left (settings for example) and then go back into Rules & Blocks.
Your saved rule is visible
How does it work?
The next part is simple
Head to the application you want the alerts from and specify it should send its email alerts to the address setup above
I head to papertrail, specify alerts should be sent to firstname.lastname@example.org
Now my alerts go to Discord and not email
There are plenty of other reasons for using CatchMailNot for redirecting mails to other mail accounts or anonymising the setup of SaaS services. As you can see from the example above, what is seen is mail format, so it’s not pretty, but it does work and it does allow me to carry on having all my alerting going into my discord server.