Describe the bug
When an email fails to send in send_email(), the exception will hit the top of the stack and present a 500. This can leave articles in an incomplete transition state when the message is sent as part of an event chain and users wondering what went wrong and if the email was sent at all.
Janeway version
v1.8.0
To Reproduce
Steps to reproduce the behavior:
- Reproduce an error in
send_email (wrong credentials, explicit exception raise...)
- Move an article through the workflow sending an email
- See error
Expected behavior
The exception should be handled and logged. The email log should have an entry with a status of "ERROR" and a resend option. The user should see a prompt / toaster of some kind indicating that the email failed to send and a link to the email log.
Additional context
We've found that all the outgoing emails, one way or another, will always be sent out via utils/notify_plugins/notify_email.py.send_email, which makes the scope of this issue simpler to resolve.
e.g. for an exception:
File "utils/notify_plugins/notify_email.py", line 164, in notify_hook
response = send_email(
File "utils/notify_plugins/notify_email.py", line 127, in send_email
return msg.send()
File "django/core/mail/message.py", line 299, in send
return self.get_connection(fail_silently).send_messages([self])
File "django_mailgun.py", line 187, in send_messages
response = self._send(message)
File "django_mailgun.py", line 171, in _send
raise MailgunAPIError(response)
MailgunAPIError: <Response [401]>
Describe the bug
When an email fails to send in
send_email(), the exception will hit the top of the stack and present a 500. This can leave articles in an incomplete transition state when the message is sent as part of an event chain and users wondering what went wrong and if the email was sent at all.Janeway version
v1.8.0
To Reproduce
Steps to reproduce the behavior:
send_email(wrong credentials, explicit exception raise...)Expected behavior
The exception should be handled and logged. The email log should have an entry with a status of "ERROR" and a resend option. The user should see a prompt / toaster of some kind indicating that the email failed to send and a link to the email log.
Additional context
We've found that all the outgoing emails, one way or another, will always be sent out via
utils/notify_plugins/notify_email.py.send_email, which makes the scope of this issue simpler to resolve.e.g. for an exception: