Files
MailForms/helpers/send_email.py
2026-03-04 09:52:43 +02:00

17 lines
556 B
Python

import smtplib
# --- HELPER TRIMITE EMAIL (GMAIL) ---
def send_gmail(to_email, subject, body):
# Folosește App Password-ul tău de la Google aici
user = "macamete.robert@gmail.com"
pw = "advx yqlv jkaa czvr"
msg = f"Subject: {subject}\nContent-Type: text/html\n\n{body}"
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login(user, pw)
server.sendmail(user, to_email, msg)
server.quit()
return True
except Exception as e:
print(f"Eroare mail: {e}")
return False