KostyaEsmukov/smtp_to_telegram

A simple program that listens for SMTP and forwards all incoming Email messages to Telegram

Go

461

91 commits

updated Aug 29, 2026

See the code

README

SMTP to Telegram

Docker Hub License

smtp_to_telegram is a simple program that listens for SMTP and forwards all incoming Email messages to Telegram.

Say you have a software that can send Email notifications via SMTP. You can use smtp_to_telegram as an SMTP server so the notification mail would be sent to the chosen Telegram chats.

Getting started

  1. Create a new Telegram bot: https://core.telegram.org/bots#creating-a-new-bot.
  2. Open that bot account in the Telegram account that should receive the messages, press /start.
  3. Retrieve a chat id with curl https://api.telegram.org/bot<BOT_TOKEN>/getUpdates.
  4. Repeat steps 2 and 3 for each Telegram account that should receive the messages.
  5. Start a docker container:
docker run \
    --name smtp_to_telegram \
    -e ST_TELEGRAM_CHAT_IDS=<CHAT_ID1>,<CHAT_ID2> \
    -e ST_TELEGRAM_BOT_TOKEN=<BOT_TOKEN> \
    kostyaesmukov/smtp_to_telegram

Assuming that your Email-sending software is running in docker as well, you can use smtp_to_telegram:2525 as the target SMTP address. No TLS or authentication is required.

The default Telegram message format is:

From: {from}\\nTo: {to}\\nSubject: {subject}\\n\\n{body}\\n\\n{attachments_details}

A custom format can be specified as well:

docker run \
    --name smtp_to_telegram \
    -e ST_TELEGRAM_CHAT_IDS=<CHAT_ID1>,<CHAT_ID2> \
    -e ST_TELEGRAM_BOT_TOKEN=<BOT_TOKEN> \
    -e ST_TELEGRAM_MESSAGE_TEMPLATE="Subject: {subject}\\n\\n{body}" \
    kostyaesmukov/smtp_to_telegram
smtp
telegram
telegram-bot

Contributors

KostyaEsmukov

89 commits

fopina

2 commits

KostyaEsmukov/smtp_to_telegram

A simple program that listens for SMTP and forwards all incoming Email messages to Telegram

Go

461

91 commits

updated Aug 29, 2026

See the code

README

SMTP to Telegram

Docker Hub License

smtp_to_telegram is a simple program that listens for SMTP and forwards all incoming Email messages to Telegram.

Say you have a software that can send Email notifications via SMTP. You can use smtp_to_telegram as an SMTP server so the notification mail would be sent to the chosen Telegram chats.

Getting started

  1. Create a new Telegram bot: https://core.telegram.org/bots#creating-a-new-bot.
  2. Open that bot account in the Telegram account that should receive the messages, press /start.
  3. Retrieve a chat id with curl https://api.telegram.org/bot<BOT_TOKEN>/getUpdates.
  4. Repeat steps 2 and 3 for each Telegram account that should receive the messages.
  5. Start a docker container:
docker run \
    --name smtp_to_telegram \
    -e ST_TELEGRAM_CHAT_IDS=<CHAT_ID1>,<CHAT_ID2> \
    -e ST_TELEGRAM_BOT_TOKEN=<BOT_TOKEN> \
    kostyaesmukov/smtp_to_telegram

Assuming that your Email-sending software is running in docker as well, you can use smtp_to_telegram:2525 as the target SMTP address. No TLS or authentication is required.

The default Telegram message format is:

From: {from}\\nTo: {to}\\nSubject: {subject}\\n\\n{body}\\n\\n{attachments_details}

A custom format can be specified as well:

docker run \
    --name smtp_to_telegram \
    -e ST_TELEGRAM_CHAT_IDS=<CHAT_ID1>,<CHAT_ID2> \
    -e ST_TELEGRAM_BOT_TOKEN=<BOT_TOKEN> \
    -e ST_TELEGRAM_MESSAGE_TEMPLATE="Subject: {subject}\\n\\n{body}" \
    kostyaesmukov/smtp_to_telegram
smtp
telegram
telegram-bot

Contributors

KostyaEsmukov

89 commits

fopina

2 commits

Languages

Go

98.4%

Dockerfile

1.6%