From 3231fbd478788dcde6e4bf87521bda7c462c5bee Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 25 Mar 2024 11:46:29 +0200 Subject: Do not try to send email when recipient is an empty string --- email_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/email_client.py b/email_client.py index e06c901..8cad903 100644 --- a/email_client.py +++ b/email_client.py @@ -69,7 +69,7 @@ else: def send_participation_email(poll_id: str, voter_name: str): poll = db.get_poll(poll_id) - if not poll or poll.author_email is None: + if not poll or poll.author_email is None or poll.author_email.strip() == "": return print(f"Sending participation email to {poll.author_email}") @@ -88,7 +88,7 @@ def send_participation_email(poll_id: str, voter_name: str): def send_poll_created_email(poll_id: str): poll = db.get_poll(poll_id) - if not poll or poll.author_email is None: + if not poll or poll.author_email is None or poll.author_email.strip() == "": return print(f"Sending poll created email to {poll.author_email}") -- cgit v1.3