Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): correctly check if email service is set up (#9497)

Nicholas Tindledcbbe11c537e
diff --git a/autogpt_platform/backend/backend/notifications/email.py b/autogpt_platform/backend/backend/notifications/email.py
index a57f5b3a41..a97d30f0bc 100644
--- a/autogpt_platform/backend/backend/notifications/email.py
+++ b/autogpt_platform/backend/backend/notifications/email.py
@@ -41,6 +41,7 @@ class EmailSender:
logger.warning(
"Postmark server API token not found, email sending disabled"
)
+ self.postmark = None
self.formatter = TextFormatter()
def send_templated(
@@ -90,6 +91,9 @@ class EmailSender:
)
def _send_email(self, user_email: str, subject: str, body: str):
+ if not self.postmark:
+ logger.warning("Email tried to send without postmark configured")
+ return
logger.debug(f"Sending email to {user_email} with subject {subject}")
self.postmark.emails.send(
From=settings.config.postmark_sender_email,