init stacks
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
def log_alert(message: str):
|
||||
ts = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
print(f"[ALERTE][{ts}]\n{message}\n")
|
||||
@@ -0,0 +1,15 @@
|
||||
import smtplib
|
||||
from email.message import EmailMessage
|
||||
import os
|
||||
|
||||
def send_mail(body: str):
|
||||
msg = EmailMessage()
|
||||
msg["Subject"] = "Alerte Infrastructure"
|
||||
msg["From"] = os.getenv("SMTP_USER")
|
||||
msg["To"] = os.getenv("MAIL_TO")
|
||||
msg.set_content(body)
|
||||
|
||||
with smtplib.SMTP(os.getenv("SMTP_HOST"), int(os.getenv("SMTP_PORT"))) as s:
|
||||
s.starttls()
|
||||
s.login(os.getenv("SMTP_USER"), os.getenv("SMTP_PASS"))
|
||||
s.send_message(msg)
|
||||
Reference in New Issue
Block a user