From 9a310bdd5ccc91dcab80328eb49efe3abf977b56 Mon Sep 17 00:00:00 2001 From: Matthias <matthias.mair@oewf.org> Date: Thu, 7 Oct 2021 17:42:20 +0200 Subject: [PATCH] do not send if not configured --- InvenTree/InvenTree/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 47d33e621d..8b4b87637c 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -266,6 +266,11 @@ class CustomAccountAdapter(RegistratonMixin, DefaultAccountAdapter): """ Override of adapter to use dynamic settings """ + def send_mail(self, template_prefix, email, context): + """only send mail if backend configured""" + if InvenTreeSetting.get_setting('EMAIL_HOST', None): + return super().send_mail(template_prefix, email, context) + return False class CustomSocialAccountAdapter(RegistratonMixin, DefaultSocialAccountAdapter):