Slack alerts
On this page
Post a message to a Slack channel whenever your site fails to send an email, using a Slack incoming webhook.
This article shows you how to have CRM-NG SMTP post to a Slack channel every time an email fails to send. It is for teams that live in Slack and want email problems to show up where they already look.
Slack alerts do not depend on your mail service, so they still arrive when the mail service itself is down. That makes them a good partner to, or replacement for, alert emails.
Before you start
- You need permission to add apps to your Slack workspace. On some company workspaces an admin must approve this.
- Pick or create the channel the alerts should go to, for example
#site-alerts.
Step 1: Create an incoming webhook in Slack
Slack's screens change from time to time. Look for these names if a step looks different.
- Open the Slack app directory
Go to
https://api.slack.com/appswhile signed in to your workspace. - Create an app
Choose Create New App, then From scratch. Give it a name such as "Website email alerts" and pick your workspace.
- Turn on incoming webhooks
In the app's settings, open Incoming Webhooks and switch the feature on.
- Add a webhook to your channel
Choose Add New Webhook to Workspace, pick the channel, and allow access. If your workspace needs approval, Slack sends a request to an admin first.
- Copy the webhook URL
Slack shows an address that starts with
https://hooks.slack.com/services/. Copy the whole thing.
Keep the URL private
Anyone who has the webhook URL can post to your channel. Do not paste it into public tickets, chats or code repositories. If it leaks, delete the webhook in Slack and create a new one.
Step 2: Add it in CRM-NG SMTP
- Open the Alerts tab
Go to CRM-NG SMTP → Settings → Alerts.
- Find the chat section
Scroll to Chat and Incident Webhooks.
- Paste the URL
Paste it into Slack webhook URL.
- Save
Press Save Alert Settings.
After saving, the box is empty and shows Saved — leave blank to keep. That is normal: the URL is stored encrypted and is never shown again. To change it, paste a new one and save. Leaving the box blank keeps the saved URL.
Step 3: Test it
The simplest test is on a staging copy of your site, or at a quiet time:
- On the General tab, change your mailer's API key or password to something wrong and save.
- Go to Tools → Email Test and send a test.
- Check your Slack channel for the alert.
- Put the correct key or password back, save, and send another test to confirm normal sending.
What the message looks like
Each alert is a plain message with four lines:
[Your Site Name] WordPress email failed
Subject: Your order #1042 has shipped
From: shop@example.com
Error: (the error text from your mailer)
One message is posted per failed email. If your mailer is down on a busy site, expect a burst of messages. Slack may slow down very fast bursts.
Troubleshooting
- Nothing arrives. Check that you pasted the full URL and pressed Save Alert Settings. Also check that the Slack app has not been removed or the channel archived.
- Your server cannot reach Slack. Alerts are sent from your web server over HTTPS. A strict firewall may block outbound requests. Ask your host to allow connections to
hooks.slack.com. - Only true failures raise an alert. An email rescued by the backup transport, or blocked by Do Not Send, does not raise an alert. See Email failure alerts.
