Add sendmail scripts

This commit is contained in:
Thomas Avé 2024-03-30 14:14:20 +00:00
parent d851805534
commit 39ed323d3b
2 changed files with 20 additions and 0 deletions

2
scripts/sendmail Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
tee -a /home/server/mail.log | /usr/sbin/sendmailtelegram

18
scripts/sendmailtelegram Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python3
import telegram
import fileinput
import asyncio
async def run():
text = "Vault Etienne:\n\n"
for line in fileinput.input():
text += line
bot = telegram.Bot(token="381718873:AAElFmI2BDjumCehhWicuksE0vutrPSkoGA")
chat_id = 125754925
await bot.send_message(chat_id, text)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([loop.create_task(run())]))
loop.close()