If you run any servers at all, chances are they occasionally send you system notifications. And because they use the local mail delivery system, it’s likely you never get to read them or only when it’s too late – all local mail by default ends up in
/var/spool/mail/root. You need to SSH to the server to get a cute You have new mail notification in the terminal.
The common solution is to enable forwarding to an external email address. But this is unreliable because messages get often marked as spam or rejected by the receiving server—unless you take extra care to make your host look like a legit mail server to the outer world.
Another issue is that Unix servers don’t come with a Share in Slack feature for some reason.
Let’s quickly fix both:
2. Install a mail transport agent on your server, for example:
$ yum -y install mailx postfix && systemctl enable postfix && systemctl start postfix
3. Enable forwarding of all
root mail to Slack:
$ echo [email protected] > /root/.forward
You’ve just established a direct email line from your server to Slack. Let’s test it out:
$ echo 'Hello, Slack!' | mail -s 'Check 123' root
Or something a little bit more useful:
$ pg_dump | mail -s 'DB backup' root
…just kidding, don’t do that. But you get the idea.
As you can see, you can now send messages from your server to Slack simply by mailing to
By the way, this is what system services—such as
logwatch, and others—already use for notifications about important events and problems. So you’ll get those automatically to Slack as well:
Create your free account to unlock your custom reading experience.