diff --git a/config.sample.py b/config.sample.py index 6f21110..5c45afa 100644 --- a/config.sample.py +++ b/config.sample.py @@ -5,3 +5,5 @@ people = { } sender = "Randomizer " + +debug = False diff --git a/mail.py b/mail.py index 4a184d2..0663e01 100644 --- a/mail.py +++ b/mail.py @@ -1,7 +1,7 @@ import smtplib from email.mime.text import MIMEText -from config import sender +from config import sender, debug s = smtplib.SMTP('localhost') @@ -13,5 +13,5 @@ def notify(name: str, email: str, chosen_person: str) -> None: msg['Subject'] = f"Result of shuffle for {name}" msg['From'] = sender msg['To'] = to - print(msg.as_string()) + if debug: print(msg.as_string()) s.sendmail(sender, [to], msg.as_string()) diff --git a/main.py b/main.py index 7d56da8..6fc4b63 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,11 @@ -from config import people +from config import people, debug from derangement import get_derangement from mail import notify names = list(people.keys()) shuffled = get_derangement(names) -print(shuffled) +if debug: print(shuffled) i = 0 for name, email in people.items():