openlibhums / openlibhums/janeway

Errors during sending of email notifications should be handled gracefully

Open
#5,384 0 comments 0 reactions 1 assignee View on GitHub

@mauromsl is already working on this.

Since Jul 15, 2026.

bug Email Priority urgent Size M
Dominant language
Python
Stars
238
Forks
97
Avg merge
9d 1h
Merged PRs (30d)
8

Description

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:

  1. Reproduce an error in send_email (wrong credentials, explicit exception raise...)
  2. Move an article through the workflow sending an email
  3. 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]>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.