Send GET requests to send an e-mail.
10K+
It provides an HTTP endpoint that can be used to send e-mails.
At home I have InfluxDB running that is populated with data by scheduled scripts. When a script fails, or when the source of the script is unavailable, no data will be stored in InfluxDB. InfluxDB provides a deadman switch type of alert, which means that it can notify if no new data is ingested. It supports Slack, PagerDuty and Webhooks. I use the webhook method, having it request this endpoint and notify me by email on any alert.
Several other similar services are available online, e.g. Zapier or If-this-then-that, but these are commercial offerings with a (limited) free plan. I prefer to run my own solution on-premise.
It is based on Alpine linux, a very lightweight base image. On top of that Apache2/PHP is installed and the webhooks.php script is served. It also adds mailx as a mail client and msmtp as a simple SMTP client. This allows PHP to send e-mail. It exposes port 80 to receive the requests.
The image needs the following files, just make sure to bind-mount them when you run the image
The msmtp project has proper documentation. This is the configuration I use with my gmail account.
# Set default values
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
syslog on
# Gmail
account gmail
host smtp.gmail.com
port 587
from [email protected]
user [email protected]
password mypassword
# Set a default account
account default : gmail
aliases /etc/aliases
Note: you should never use your real password here. Make sure you have 2FA enabled in your gmail account, and create an appkey at https://myaccount.google.com/apppasswords
Do NEVER expose this service to the Internet directly. If you do, you are allowing everybody to send e-mails on your behalf. The connection to the URL is unencrypted and the contents of the message are in the URL, which means that other can sniff this information without you noticing.
This image is build from this public Github repo.
Content type
Image
Digest
sha256:375e1fb92…
Size
17.1 MB
Last updated
6 months ago
docker pull martinh80/webhooks