Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leoverto/email2signal
Forward received emails to signal-cli-rest-api
https://github.com/leoverto/email2signal
Last synced: 2 months ago
JSON representation
Forward received emails to signal-cli-rest-api
- Host: GitHub
- URL: https://github.com/leoverto/email2signal
- Owner: LeoVerto
- License: gpl-3.0
- Created: 2020-07-23T14:44:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T11:01:41.000Z (almost 2 years ago)
- Last Synced: 2023-03-25T19:41:23.216Z (over 1 year ago)
- Language: Python
- Size: 49.8 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Forward email notifications to signal using signal-cli
This project was built to solve my my use case of sending Grafana alerts via Signal (see [grafana/grafana#14952](https://github.com/grafana/grafana/issues/14952) for the open issue).
Currently this just means that a Docker container running a Python app listens on port 8025 for incoming emails, extracts the
subject and the first image (if it exists), and finally utilizes another container running signal-cli ([bbernhard/signal-cli-rest-api](https://github.com/bbernhard/signal-cli-rest-api))
to send a message to a signal number set in the receiver address.If the receiver address does not follow the format as specified below, the email is instead forwarded using an external SMTP server.
## Setup
### DANGER
If you run this service with port 8025 exposed on a server directly connected to the internet,
you will be running an open SMTP relay and bad actors ***will*** use it to send spam emails.If you only send emails from other docker containers, remove the commented out
`ports:` section.To send messages from local, non-dockerized services, uncomment the lines but make sure
the `127.0.0.1` remains so the container is only available via localhost.Otherwise run the server in a network behind a firewall if you don't want your server to be abused and your IP to be blacklisted.
The easiest way to set up this project is by using docker-compose with a compose file based on the following template:
```yaml
version: "2.4"services:
signal-rest:
image: bbernhard/signal-cli-rest-api:latest
container_name: signal-rest
restart: always
volumes:
- ./signal-rest:/home/.local/share/signal-cli
email2signal:
image: leoverto/email2signal:latest
container_name: email2signal
restart: always
# ports:
# - 127.0.0.1:8025:8025
environment:
- SIGNAL_REST_URL=http://signal-rest:8080
- SENDER_NUMBER
- SMTP_HOST
- SMTP_USER
- SMTP_PASSWORD
depends_on:
- signal-rest
```[signal-cli-rest-api](https://github.com/bbernhard/signal-cli-rest-api) needs to be setup by either copying the `data` folder from a local signal-cli installation
into `./signal-rest` or exposing port 8080 on the container temporarily and registering a number via the API.You need to set the variables listed in the docker-compose file (preferrably by using a .env file). If you don't need to forward emails to an external SMTP server
you can set the `SMTP_*` variables to an empty string.The receiver address for the emails has to follow the format `[SIGNAL_NUMBER]@signal.localdomain`, otherwise they will be forwarded to the SMTP server.
## Grafana
This has not been tested to work with the "Single email" setting. Make sure "Include image" is enabled if you want to receive snapshots of the alert graph.