27 lines
785 B
Python
27 lines
785 B
Python
import ssl
|
|
import smtplib
|
|
from email.message import EmailMessage
|
|
|
|
config = {
|
|
"server": "ssl0.ovh.net",
|
|
"port": 465,
|
|
"email": "auto@chauvet.pro",
|
|
"password": "#FL7Sf*9hZMkund24$a@46ny7Dx",
|
|
"display_name": "no-reply@chauvet.pro"
|
|
}
|
|
|
|
def send_mail(mail_add:str, subject:str, mail_content:str):
|
|
email = EmailMessage()
|
|
email['From'] = config["display_name"]
|
|
email["To"] = mail_add;
|
|
email["subject"] = subject;
|
|
email.set_content(mail_content);
|
|
|
|
context = ssl.create_default_context();
|
|
|
|
with smtplib.SMTP_SSL(config["server"], config["port"], context=context) as smtp:
|
|
smtp.login(config["email"], config["password"]);
|
|
smtp.sendmail(config["email"], mail_add, email.as_string());
|
|
|
|
send_mail("camille@chauvet.pro", "test", "text")
|