2020-05-08 14:20:41 +02:00
|
|
|
import smtplib
|
|
|
|
from email.mime.text import MIMEText
|
|
|
|
|
2020-05-08 14:26:10 +02:00
|
|
|
from config import sender, debug
|
2020-05-08 14:20:41 +02:00
|
|
|
|
|
|
|
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
|
2020-05-08 14:26:10 +02:00
|
|
|
if debug: print(msg.as_string())
|
2020-05-08 14:20:41 +02:00
|
|
|
s.sendmail(sender, [to], msg.as_string())
|