https://github.com/conformist-mw/sendmail
GNU/Linux sendmail implementation to send all mails to the Telegram bot
https://github.com/conformist-mw/sendmail
mail mail-transport-agent mta python telegram
Last synced: 11 months ago
JSON representation
GNU/Linux sendmail implementation to send all mails to the Telegram bot
- Host: GitHub
- URL: https://github.com/conformist-mw/sendmail
- Owner: conformist-mw
- License: mit
- Created: 2021-11-11T12:58:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-12T16:48:43.000Z (over 2 years ago)
- Last Synced: 2025-07-31T11:07:27.757Z (11 months ago)
- Topics: mail, mail-transport-agent, mta, python, telegram
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sendmail to telegram bot
[](https://github.com/conformist-mw/sendmail/actions/workflows/build.yaml)

### Description
Traditionally email has been used in Linux to communication or inform the user about some kind of problems. In the current environment it is rather difficult to set up a good mail server so that outgoing mail does not end up in spam.
This project exists to simplify the notification to the end user. In Linux all programs that want to send an email somewhere always use `/usr/sbin/sendmail`. This project implements that command and also provides a mail-transport-agent package so that it is possible to send mails manually e.g. with the `mailutils` or `bsd-mailx` packages (these require that an MTA is installed, usually Postfix/Exim/Sendmail and so on).
### Installation
There are two ways to install it:
1. Recommended
- go to [Releases](https://github.com/conformist-mw/sendmail/releases) and download current `tg-sendmail_x.x.x_all.deb`
- install:
```shell
sudo apt install ./tg-sendmail_x.x.x_all.deb
```
- optionally (to send mails as user):
```shell
sudo apt install bsd-mailx # or mailutils
```
2. Manual
- clone this repo
- copy files to their destinations:
```shell
sudo cp src/sendmail.py /usr/sbin/sendmail
sudo cp src/sendmail.ini /etc/tg-sendmail.ini # fill values
sudo touch /var/log/tg-sendmail.log
sudo chmod 666 /var/log/tg-sendmail.log
```
### Build package yourself
```shell
git clone https://github.com/conformist-mw/sendmail
cd sendmail
sudo apt install devscripts debhelper dh-exec dh-make dh-python
debuild --no-lintian
```
### Usage
After installation, you can check how it works for cron tasks, which notify the user by email in case of an error:
- add a knowingly erroneous command to the cron:
```shell
* * * * * /usr/bin/non-existent-command
```

Send emails:
```shell
$ echo 'Mail from the server' | mail -s 'Test subject' oleg.smedyuk@gmail.com
```

Send files (see telegram bot api [limitations](https://core.telegram.org/bots/api#sending-files)):
```shell
$ sendmail --send-file /var/log/tg-sendmail.log
```
