The go-smtp2telegram application is a tool that allows you to forward SMTP emails to Telegram. It provides a convenient way to receive email notifications directly on your Telegram account. It includes a webserver to be able to view html mails that is to complex for telegram and some basic spam protection
Stores html mail in ./mail/[chatId]
folder, then sends a link to it to the user.
Quick hack to learn go, use with caution 😊
To install and build the go-smtp2telegram application, follow these steps:
-
Clone the repository:
git clone [email protected]:matst80/go-smtp2telegram.git
-
Change to the project directory:
cd go-smtp2telegram go mod download
-
Build the application:
go build
-
Create your configuration file config.json, copy example from config.example.json
-
Run the application:
./crapmail
Build the application or use matst80/go-mail2telegram
docker build -t mail2telegram .
docker run -v ./mail:/mail -v ./config.json:/config.json -p 25:25 -p 8080:8080 mail2telegram
The config.json file is used to store configuration settings for your project. It typically contains various parameters that define the behavior and settings of your application. Let's take a look at some common parameters that you might find in a config.json file:
Remember to keep sensitive information, such as passwords or API keys, secure and avoid committing them to version control systems.
listen
address for smtp server default0.0.0.0:25
domain
domain/hostname that the smtp server responds withtoken
telegram bot token instructionshashSalt
A string salt for basic user integrity (by no means safe) defaults tosalty-change-me
baseUrl
webserver public address. f.ex. http://mail.domain.comusers
list of email and chatId objects, others will be discardedstopWords
A list of blocking words that will be used for basic spam protection.warningWords
A list of words that increases the spam rankingblockedIps
A list of blocked ipswarningWordsUrl
Url to download spam wordlist separated by \nblockedIpUrl
Url to fetch updated spam classed ip numbers separated by \n
Webserver that is used has basic hash so you can still share emails but at least have some security, strict content policy for everything except images and media
will log the chatId on the server
Will add the the email addresses to the user that sends the message, sends the users list to be used to update the config.json file
Updates the blocked ips list if a blockedIpUrl is provided in the config
Updates the warning word list if a blockedIpUrl is provided in the config
Replies the current configuration json
Replies the current users json