From 75c10df90b12106d9979e3e47aa2b4c328aa925d Mon Sep 17 00:00:00 2001 From: Joshua Hegedus Date: Tue, 16 Apr 2024 14:38:09 +0200 Subject: [PATCH] added some output messages --- routes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes.py b/routes.py index e60937b..eca94fe 100644 --- a/routes.py +++ b/routes.py @@ -155,6 +155,7 @@ def verify_key(verify_model: KeyVerifyModel): @router.post("/send/{provider}") def send_email(provider: str, send_model: SendModel): if provider not in ['gmail', 'outlook']: + print(f"Invalid provider: {provider}") return {"error": "Invalid provider"} server = 'smtp.gmail.com' if provider == 'gmail' else 'smtp-mail.outlook.com' user_config = UserConfig( @@ -181,6 +182,7 @@ def send_email(provider: str, send_model: SendModel): ) if not email_config.is_valid(): + print(f"Invalid email configuration: {email_config}") return {"error": "Invalid email configuration"} smp_config = SMTPConfig(server, 587) @@ -194,6 +196,8 @@ def send_email(provider: str, send_model: SendModel): result = signer.send_email(email_config) if result.success: + print(f"Email sent: {result.response}") return {"sent": True, "message": result.response} + print(f"Error sending email: {result.error}") return {"sent": False, "error": result.error}