Exceptions no longer being mailed to ADMINS #5378

Closed
opened 2025-12-29 19:27:18 +01:00 by adam · 3 comments
Owner

Originally created by @candlerb on GitHub (Sep 16, 2021).

NetBox version

v3.0.2

Python version

3.8

Steps to Reproduce

  1. Configure EMAIL and at least one E-mail address in ADMINS
  2. Make an exception. (Use one of the current open bugs, e.g. trace from a rearport which has no connected frontport; or at worst add a raise somewhere)

Expected Behavior

Exception detail E-mail to be sent out. (This used to work).

Observed Behavior

On the two instances I've upgraded to Netbox v3.0.2, no exception E-mails are being sent.

Originally created by @candlerb on GitHub (Sep 16, 2021). ### NetBox version v3.0.2 ### Python version 3.8 ### Steps to Reproduce 1. Configure EMAIL and at least one E-mail address in ADMINS 2. Make an exception. (Use one of the current open bugs, e.g. trace from a rearport which has no connected frontport; or at worst add a `raise` somewhere) ### Expected Behavior Exception detail E-mail to be sent out. (This used to work). ### Observed Behavior On the two instances I've upgraded to Netbox v3.0.2, no exception E-mails are being sent.
adam added the type: bugstatus: under review labels 2025-12-29 19:27:18 +01:00
adam closed this issue 2025-12-29 19:27:19 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 16, 2021):

This is working normally for me. You might want to check

  1. That you have at least one (name, email) tuple defined under ADMINS
  2. That the EMAIL parameters are all correct (note that this differs slightly from Django's native settings)
  3. [Edit for posterity] DEBUG is False

You can also try sending a test email using the sendtestemail management command. A simple receiver can be started locally to receive these (with the proper configuration applied) to eliminate the mail service during testing:

python -m smtpd -n -c DebuggingServer localhost:1025
@jeremystretch commented on GitHub (Sep 16, 2021): This is working normally for me. You might want to check 1. That you have at least one (name, email) tuple defined under `ADMINS` 2. That the [`EMAIL`](https://netbox.readthedocs.io/en/stable/configuration/optional-settings/#email) parameters are all correct (note that this differs slightly from Django's native settings) 3. [Edit for posterity] `DEBUG` is False You can also try sending a test email using the `sendtestemail` management command. A [simple receiver](https://docs.djangoproject.com/en/3.2/topics/email/#configuring-email-for-development) can be started locally to receive these (with the proper configuration applied) to eliminate the mail service during testing: ``` python -m smtpd -n -c DebuggingServer localhost:1025 ```
Author
Owner

@candlerb commented on GitHub (Sep 16, 2021):

Hmm. sendtestemail <myaddress> and sendtestemail --admin works. However if I trigger a bug, e.g. tracing a cable from a rearport where the frontport is not connected, I only get the report on screen. And this is on two different systems.

<< DIGS >>

I've found the problems, and they were different.

On my home system (which sends to my personal E-mail, self-hosted): tcpdump shows no attempt to send E-mails when an exception is raised. It turns out this was because I had

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'filename': '/opt/netbox/log/netbox.log',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'level': 'INFO',
        },
        'netbox': {
            'handlers': ['file'],
            'level': 'INFO',
        },
    },
}

in configuration.py. Setting it back to LOGGING = {} fixed it.

The production system had standard logging, and the ADMINS address pointed to a corporate Gmail mailbox. I found the exceptions in the "spam" folder flagged as "dangerous":

image

Even if I click "Looks safe", and select all the others and mark "not spam", subsequent exceptions are still marked as dangerous and filed as spam. But they certainly are being delivered.

It was working before, but maybe Google have tightened their rules, or a change in the content of the E-mails is making them look "spammier" than they were before.

In any case, sorry for the noise - Netbox working as intended.

@candlerb commented on GitHub (Sep 16, 2021): Hmm. `sendtestemail <myaddress>` and `sendtestemail --admin` works. However if I trigger a bug, e.g. tracing a cable from a rearport where the frontport is not connected, I only get the report on screen. And this is on two different systems. << DIGS >> I've found the problems, and they were different. On my home system (which sends to my personal E-mail, self-hosted): tcpdump shows no attempt to send E-mails when an exception is raised. It turns out this was because I had ``` LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'INFO', 'class': 'logging.FileHandler', 'filename': '/opt/netbox/log/netbox.log', }, }, 'loggers': { 'django': { 'handlers': ['file'], 'level': 'INFO', }, 'netbox': { 'handlers': ['file'], 'level': 'INFO', }, }, } ``` in `configuration.py`. Setting it back to `LOGGING = {}` fixed it. The production system had standard logging, and the ADMINS address pointed to a corporate Gmail mailbox. I found the exceptions in the "spam" folder flagged as "dangerous": ![image](https://user-images.githubusercontent.com/44789/133617814-284328e1-c081-4612-8944-30a2152d558e.png) Even if I click "Looks safe", and select all the others and mark "not spam", subsequent exceptions are still marked as dangerous and filed as spam. But they certainly are being delivered. It was working before, but maybe Google have tightened their rules, or a change in the content of the E-mails is making them look "spammier" than they were before. In any case, sorry for the noise - Netbox working as intended.
Author
Owner

@jeremystretch commented on GitHub (Sep 16, 2021):

Thanks for the detailed follow-up!

@jeremystretch commented on GitHub (Sep 16, 2021): Thanks for the detailed follow-up!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5378