import smtplib
from email.mime.text import MIMEText

# def send_email(to: str, subject: str, body: str):
#     smtp_host = "smtp.gmail.com"
#     smtp_port = 587
#     smtp_user = "info@compunet.solutions"
#     smtp_pass = "Jn193518f"

#     msg = MIMEText(body)
#     msg["Subject"] = subject
#     msg["From"] = smtp_user
#     msg["To"] = to

#     with smtplib.SMTP(smtp_host, smtp_port) as server:
#         server.starttls()
#         server.login(smtp_user, smtp_pass)
#         server.sendmail(smtp_user, [to], msg.as_string())

def send_email(to: str, subject: str, body: str):
    smtp_host = "mail.compunet.solutions"   # ✅ Your domain mail server
    smtp_port = 587
    smtp_user = "info@compunet.solutions"   # ✅ Full email address
    smtp_pass = "Jn193518f"                 # ✅ Mailbox password (set in cPanel)

    msg = MIMEText(body)
    msg["Subject"] = subject
    msg["From"] = smtp_user
    msg["To"] = to

    with smtplib.SMTP(smtp_host, smtp_port) as server:
        server.starttls()
        server.login(smtp_user, smtp_pass)
        server.sendmail(smtp_user, [to], msg.as_string())
