Posting a message to Slack using procmail when receiving an email

How to do it

1. Get a Slack Webhook URL

Get a Slack webhook URL to use Slack API.
See Sending messages using Incoming Webhooks - Slack API

2. Create a shell script posting a message to slack

Create a shell script like below and give +x permission to the receiving user.

3. Add a recipe to .procmailrc for executing the shell script

The example .procmail is like below.
Procmail executes the shell script when receives an email and forward the email to $MAILDIR