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)
