diff --git a/docs/configuration/optional-settings.md b/docs/configuration/optional-settings.md index 3f2b29b87..4d5251f25 100644 --- a/docs/configuration/optional-settings.md +++ b/docs/configuration/optional-settings.md @@ -108,16 +108,20 @@ The file path to NetBox's documentation. This is used when presenting context-se ## EMAIL -In order to send email, NetBox needs an email server configured. The following items can be defined within the `EMAIL` setting: +In order to send email, NetBox needs an email server configured. The following items can be defined within the `EMAIL` configuration parameter: -* SERVER - Host name or IP address of the email server (use `localhost` if running locally) -* PORT - TCP port to use for the connection (default: 25) -* USERNAME - Username with which to authenticate -* PASSSWORD - Password with which to authenticate -* TIMEOUT - Amount of time to wait for a connection (seconds) -* FROM_EMAIL - Sender address for emails sent by NetBox +* `SERVER` - Host name or IP address of the email server (use `localhost` if running locally) +* `PORT` - TCP port to use for the connection (default: `25`) +* `USERNAME` - Username with which to authenticate +* `PASSSWORD` - Password with which to authenticate +* `USE_SSL` - Use SSL when connecting to the server (default: `False`). Mutually exclusive with `USE_TLS`. +* `USE_TLS` - Use TLS when connecting to the server (default: `False`). Mutually exclusive with `USE_SSL`. +* `SSL_CERTFILE` - Path to the PEM-formatted SSL certificate file (optional) +* `SSL_KEYFILE` - Path to the PEM-formatted SSL private key file (optional) +* `TIMEOUT` - Amount of time to wait for a connection, in seconds (default: `10`) +* `FROM_EMAIL` - Sender address for emails sent by NetBox (default: `root@localhost`) -Email is sent from NetBox only for critical events. If you would like to test the email server configuration please use the django function [send_mail()](https://docs.djangoproject.com/en/stable/topics/email/#send-mail): +Email is sent from NetBox only for critical events or if configured for [logging](#logging). If you would like to test the email server configuration please use the django function [send_mail()](https://docs.djangoproject.com/en/stable/topics/email/#send-mail): ``` # python ./manage.py nbshell diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index 416ac2bc6..e15df481d 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -2,6 +2,10 @@ v2.8.4 (FUTURE) +### Enhancements + +* [#4632](https://github.com/netbox-community/netbox/issues/4632) - Extend email configuration parameters to support SSL/TLS + ### Bug Fixes * [#4598](https://github.com/netbox-community/netbox/issues/4598) - Display error message when invalid cable length is specified diff --git a/netbox/netbox/configuration.example.py b/netbox/netbox/configuration.example.py index 94497f3cd..a020c4322 100644 --- a/netbox/netbox/configuration.example.py +++ b/netbox/netbox/configuration.example.py @@ -108,6 +108,8 @@ EMAIL = { 'PORT': 25, 'USERNAME': '', 'PASSWORD': '', + 'USE_SSL': False, + 'USE_TLS': False, 'TIMEOUT': 10, # seconds 'FROM_EMAIL': '', } diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index f928ca71e..0162fabd0 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -246,12 +246,16 @@ if SESSION_FILE_PATH is not None: # EMAIL_HOST = EMAIL.get('SERVER') -EMAIL_PORT = EMAIL.get('PORT', 25) EMAIL_HOST_USER = EMAIL.get('USERNAME') EMAIL_HOST_PASSWORD = EMAIL.get('PASSWORD') +EMAIL_PORT = EMAIL.get('PORT', 25) +EMAIL_SSL_CERTFILE = EMAIL.get('SSL_CERTFILE') +EMAIL_SSL_KEYFILE = EMAIL.get('SSL_KEYFILE') +EMAIL_SUBJECT_PREFIX = '[NetBox] ' +EMAIL_USE_SSL = EMAIL.get('USE_SSL', False) +EMAIL_USE_TLS = EMAIL.get('USE_TLS', False) EMAIL_TIMEOUT = EMAIL.get('TIMEOUT', 10) SERVER_EMAIL = EMAIL.get('FROM_EMAIL') -EMAIL_SUBJECT_PREFIX = '[NetBox] ' #