mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-11 15:34:15 +00:00
Improved error handling for email support (#4862)
* Improved error handling for email support - Prevent email sending if email not configured - Check for tx email address before sending (cherry picked from commit de541f811ede030ea5eb3136132731e1dafccc31) * Update InvenTree/email.py Co-authored-by: Matthias Mair <code@mjmair.com> * Update InvenTree/email.py Co-authored-by: Matthias Mair <code@mjmair.com> * Fix location of file email.py * Allow dummy emails in testing * Provide default email in testing mode * Fix to get test working --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@ -7,6 +7,7 @@ import requests
|
||||
from allauth.account.models import EmailAddress
|
||||
|
||||
import common.models
|
||||
import InvenTree.email
|
||||
import InvenTree.helpers
|
||||
import InvenTree.tasks
|
||||
from plugin import InvenTreePlugin, registry
|
||||
@ -115,7 +116,7 @@ class InvenTreeCoreNotificationsPlugin(SettingsContentMixin, SettingsMixin, Inve
|
||||
if instance_title:
|
||||
subject = f'[{instance_title}] {subject}'
|
||||
|
||||
InvenTree.tasks.send_email(subject, '', targets, html_message=html_message)
|
||||
InvenTree.email.send_email(subject, '', targets, html_message=html_message)
|
||||
|
||||
return True
|
||||
|
||||
|
Reference in New Issue
Block a user