# Mail2slack

Mail2slack is a self-hosted automation app. Simple tool that scans an IMAP inbox and posts every incoming email to a Slack channel, so self-hosters can surface mailbox alerts in their team chat. It is open source and self-hosted, installable on Docker Hub and Unraid.

Canonical page: https://ourlocalhost.com/app/2478/mail2slack

## Description

Simple tool that scans an IMAP inbox and posts every incoming email to a Slack channel, so self-hosters can surface mailbox alerts in their team chat.

## Platform availability

Available on 1 of 10 platforms: Unraid.

## Health score

11/100 (Low), based on 3 of 4 factors.
- Maintained: 0 (last commit 981 days ago)
- Popular: 10 (2 GitHub stars)
- Easy to install: 35 (1 install platform, install notes, Docker image)

## Links

- Docker Hub: https://hub.docker.com/r/stefanknaak/mail2slack
- Unraid: https://ca.unraid.net/apps/mail2slack-0lo9osk17x6vc0?q=mail2slack

## Common questions

### How can I deploy mail2slack with Docker Compose?

Create a folder, download the sample docker-compose.yml, change the settings, and run docker-compose up -d. The README also shows a docker run command using the stefanknaak/mail2slack:latest image and environment variables.

### How do I run the native Python version?

Clone the repository, copy mail2slack.conf.sample to mail2slack.conf, edit it, install requirements with pip3, and run python mail2slack.py. You can also start it with PM2 using ecosystem.config.js.

### Which environment variables specify the Slack channel and message fields?

Set SLACK_CHANNEL for the destination channel, along with SLACK_END_POINT, SLACK_TOKEN, SLACK_SLACK_SENDER, SLACK_ICON_URL, and SLACK_SLACK_FALLBACK. The sample shows these as the Slack-related settings.

### Can it scan an IMAP folder other than Inbox?

Yes, set MAIL_FOLDER to the desired IMAP folder. The sample uses Inbox and also requires MAIL_MAILSERVER, MAIL_MAIL_LOGIN, and MAIL_MAIL_PW.

### How can I keep it running after I start it?

Use PM2 for the Python setup or Docker restart options such as --restart unless-stopped in the docker run example. The README does not provide a reverse proxy or web interface configuration.

---
Source: Our Local Host (https://ourlocalhost.com/app/2478/mail2slack), the self-hosted and open-source app directory.
