A simple local SMTP server that transform server alert email to Discord / Telegram message with attachment support.
There is a web UI to let you view the full message which is larger than the destination maximum length limit or HTML message.
The following shows the simplest setup, without any authentication. For security reason, please do not expose your SMTP (port 25) to the Internet.
First, create forwarder.yml.
- name: Discord
forwarder: discord
parameters:
webhook: YOUR_WEB_HOOK_URL
# content: "@everyone" # uncomment this if you want mention
#- name: Telegram
# forwarder: telegram
# parameters:
# bot_token: YOUR_BOT_TOKEN
# chat_id: YOUR_CHAT_IDThen, create docker container.
docker run -d \
--name=smtpbroker \
--restart=unless-stopped \
-e Web__Url=https://your-ip:8443 \
-v $PWD/forwarder.yml:/forwarder.yml:ro \
-v $PWD/data:/data \
-p 8443:443 \
-p 127.0.0.1:25:25 \
brian9206/smtpbroker:latestYou can set up SMTP or Web UI authentication by setting the environment variables
Add the following parameters to docker run command to enable authentication.
-e Web__Auth=true \
-e Web__User=YOUR_WEBUI_USERNAME \
-e Web__Password=YOUR_WEBUI_PASSWORD \
-e SMTP__Auth=true \
-e SMTP__User=YOUR_SMTP_USERNAME \
-e SMTP__Password=YOUR_SMTP_PASSWORD \You can set up multiple forwarders and let them to handle different "From" or "To" addresses.
- name: Synology Notification
forwarder: discord
rules:
from: "synology@example.com"
stop: true
parameters:
webhook: DISCORD_WEB_HOOK
content: "@everyone"
- name: Telegram
forwarder: telegram
parameters:
bot_token: BOT_TOKEN
chat_id: CHAT_IDThe above example will make all email from synology@example.com notified in Discord, others to Telegram.
Note: you can use wildcard like *@example.com and to: rule also works.
By default, the server will automatically generate a self-signed certificate on startup. If you want to install your own certificate, use the following docker parameter:
-v $PWD/server.pfx:/ssl/server.pfx:ro \
-e ASPNETCORE_Kestrel__Certificates__Default__Password=YOUR_PFX_PASSPHRASE \To get your Webhook URL, open your Discord and edit your channel. Go to [Integration > Webhook > Create Webhook > Copy Webhook URL]
To get your Telegram BOT token and Chat ID, please follow the following instruction.
- Add
@BotFather - Use
/newbotcommand - Answer the questions, and you should have your BOT token.
- Add
@getidsbot - Use
/startcommand - The ID under
Youis your chat ID.