Skip to content

A small program that listens for SMTP and sends all incoming Email messages to Telegram

License

Notifications You must be signed in to change notification settings

MuratovAS/smtptg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTPtg

Forked from simplylizz/smtp_to_telegram package.

smtptg is a small program which listens for SMTP and sends all incoming Email messages to Telegram.

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

Getting started

Run:

docker run --rm -p 25:25 -e ST_TELEGRAM_BOT_TOKEN=XXXXXXXXXXX -e ST_TELEGRAM_CHAT_IDS=XXXXXXXXX ghcr.io/muratovas/smtptg:latest

Request to check the service:

curl \
  --url 'smtp://localhost:25' \
  --mail-from [email protected] \
  --mail-rcpt [email protected] --mail-rcpt [email protected] \
  -H "Subject: Test smtptg" -F '=(;type=multipart/mixed' -F "=This message came via smtp;type=text/plain" -F '=)'

Sending personal messages is supported. Instead of email, enter an entry like [email protected]. Where 000000000 is chat id. Classic emails will still be sent to the ID specified in ST_TELEGRAM_CHAT_IDS.

Options

A custom format might be specified as well:

ST_TELEGRAM_BOT_TOKEN=<BOT_TOKEN>
ST_TELEGRAM_CHAT_IDS=[[email protected]:]<CHAT_ID1>,[[email protected]:]<CHAT_ID2> # optional
ST_TELEGRAM_MESSAGE_TEMPLATE="Subject: {subject}\\n\\n{body}" # optional
ST_SMTP_ALLOWED_HOSTS=cvzilla.net,example.com # optional

The default Telegram message format is:

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

About

A small program that listens for SMTP and sends all incoming Email messages to Telegram

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Go 99.1%
  • Dockerfile 0.9%