1
0
Fork 0
mirror of https://github.com/Findus23/shuffle.git synced 2024-09-19 14:43:45 +02:00
shuffle/mail.py
2020-05-08 14:20:41 +02:00

17 lines
453 B
Python

import smtplib
from email.mime.text import MIMEText
from config import sender
s = smtplib.SMTP('localhost')
def notify(name: str, email: str, chosen_person: str) -> None:
to = f"{name} <{email}>"
msg = MIMEText(f"Hello {name},\n\nThe chosen person is {chosen_person}.")
msg['Subject'] = f"Result of shuffle for {name}"
msg['From'] = sender
msg['To'] = to
print(msg.as_string())
s.sendmail(sender, [to], msg.as_string())