From 3db774d1fe5d43758514f57f784c3e24451f6a15 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 16 Feb 2021 21:29:53 +1100 Subject: [PATCH 1/3] Add docs for email backend --- _includes/config.yaml | 23 +++++++++++++++++++++++ docs/start/config.md | 20 +++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/_includes/config.yaml b/_includes/config.yaml index 18e3197..38b46f7 100644 --- a/_includes/config.yaml +++ b/_includes/config.yaml @@ -56,6 +56,29 @@ currencies: - NZD - USD +# Email backend configuration +# Ref: https://docs.djangoproject.com/en/dev/topics/email/ +# Available options: +# host: Email server host address +# port: Email port +# username: Account username +# password: Account password +# prefix: Email subject prefix +# tls: Enable TLS support +# ssl: Enable SSL support + +# Alternatively, these options can all be set using environment variables +# Refer to the InvenTree documentation for more information + +email: + host: '' + port: 25 + username: '' + password: '' + prefix: '[InvenTree] ' + tls: False + ssl: False + # Set debug to False to run in production mode debug: True diff --git a/docs/start/config.md b/docs/start/config.md index 6df457a..4159664 100644 --- a/docs/start/config.md +++ b/docs/start/config.md @@ -69,7 +69,7 @@ Database options are specified under the *database* heading in the configuration The following database options can be configured: -| Environment Variable | Settings File | Description | +| Environment Variable | COnfig File | Description | | --- | --- | --- | | INVENTREE_DB_ENGINE | database.ENGINE | Database backend | | INVENTREE_DB_NAME | database.NAME | Database name | @@ -121,6 +121,24 @@ It is then up to the database adminstrator to create a new PostgreSQL database t The database options (in the `config.yaml` file) then need to be adjusted to communicate the PostgreSQL backend. Refer to the [Django docs](https://docs.djangoproject.com/en/dev/ref/databases/) for further information. +### Email Backend + +InvenTree email settings must be correctly configured to allow sending emails. + +Email options are specified under the *email* heading in the configuration file. Alternatively email settings can be set via environment variables. + +The following email options can be configured: + +| Environment Variable | Config File | Description | +| --- | --- | --- | +| INVENTREE_EMAIL_HOST | email.host | Email service host address | +| INVENTREE_EMAIL_PORT | email.port | Email service host port | +| INVENTREE_EMAIL_USERNAME | email.username | Account username | +| INVENTREE_EMAIL_PASSWORD | email.password | Account password | +| INVENTREE_EMAIL_PREFIX | email.prefix | Email subject prefix - default is "[InvenTree] " | +| INVENTREE_EMAIL_TLS | email.tls | Enable TLS support | +| INVENTREE_EMAIL_SSL | email.ssl | Enable SSL support | + ### Allowed Hosts / CORS By default, all hosts are allowed, and CORS requests are enabled from any origin. **This is not secure and should be adjusted for your installation**. These options can be changed in the configuration file. From c6f662ce69e48ec4299ce5e18b66e7a034310ac6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 13 Apr 2021 20:16:59 +1000 Subject: [PATCH 2/3] Update email docs --- _includes/config.yaml | 12 +++++++----- docs/admin/email.md | 13 +++++++++++++ docs/start/config.md | 39 +++++++++++++++++++++++++++------------ mkdocs.yml | 1 + 4 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 docs/admin/email.md diff --git a/_includes/config.yaml b/_includes/config.yaml index fe93c09..e9f32f3 100644 --- a/_includes/config.yaml +++ b/_includes/config.yaml @@ -74,15 +74,17 @@ currencies: # tls: Enable TLS support # ssl: Enable SSL support -# Alternatively, these options can all be set using environment variables +# Alternatively, these options can all be set using environment variables, +# with the INVENTREE_EMAIL_ prefix: +# e.g. INVENTREE_EMAIL_HOST / INVENTREE_EMAIL_PORT / INVENTREE_EMAIL_USERNAME # Refer to the InvenTree documentation for more information email: + # backend: 'django.core.mail.backends.smtp.EmailBackend' host: '' port: 25 username: '' password: '' - prefix: '[InvenTree] ' tls: False ssl: False @@ -118,9 +120,9 @@ cors: # - https://sub.example.com # MEDIA_ROOT is the local filesystem location for storing uploaded files -# By default, it is stored under /home/inventree +# By default, it is stored under /home/inventree/data/media # Use environment variable INVENTREE_MEDIA_ROOT -media_root: '/home/inventree/media' +media_root: '/home/inventree/data/media' # STATIC_ROOT is the local filesystem location for storing static files # By default, it is stored under /home/inventree @@ -139,7 +141,7 @@ static_root: '/home/inventree/static' # Set the backup_dir parameter to store backup files in a specific location # If unspecified, the local user's temp directory will be used # Use environment variable INVENTREE_BACKUP_DIR -backup_dir: '/home/inventree/backup/' +backup_dir: '/home/inventree/data/backup/' # Permit custom authentication backends #authentication_backends: diff --git a/docs/admin/email.md b/docs/admin/email.md new file mode 100644 index 0000000..3d9d93e --- /dev/null +++ b/docs/admin/email.md @@ -0,0 +1,13 @@ +--- +title: Email Configured +--- + +## Email Settings + +InvenTree can be configured to send emails to users, for various purposes. + +To enable this, email configuration settings must be supplied to the InvenTree [configuration options](../../start/config#email-settings). + +!!! info "Password Reset" + The *Password Reset* functionality requires the email backend to be correctly configured. + diff --git a/docs/start/config.md b/docs/start/config.md index 42d2e73..891d364 100644 --- a/docs/start/config.md +++ b/docs/start/config.md @@ -42,10 +42,10 @@ In addition to specifying InvenTree options via the `config.yaml` file, these op The following basic options are available: -| Environment Variable | Settings File | Description | -| --- | --- | --- | -| INVENTREE_DEBUG | debug | Enable debug mode | -| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | +| Environment Variable | Settings File | Description | Default | +| --- | --- | --- | --- | +| INVENTREE_DEBUG | debug | Enable debug mode | True | +| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING | ## Secret Key @@ -73,15 +73,30 @@ Database options are specified under the *database* heading in the configuration The following database options can be configured: -| Environment Variable | Settings File | Description | -| --- | --- | --- | -| INVENTREE_DB_ENGINE | database.ENGINE | Database backend | -| INVENTREE_DB_NAME | database.NAME | Database name | -| INVENTREE_DB_USER | database.USER | Database username (if required) | -| INVENTREE_DB_PASSWORD | database.PASSWORD | Database password (if required) | -| INVENTREE_DB_HOST | database.HOST | Database host address (if required) | -| INVENTREE_DB_PORT | database.PORT | Database host port (if required) | +| Environment Variable | Settings File | Description | Default | +| --- | --- | --- | --- | +| INVENTREE_DB_ENGINE | database.ENGINE | Database backend | *Not set* | +| INVENTREE_DB_NAME | database.NAME | Database name | *Not set* | +| INVENTREE_DB_USER | database.USER | Database username (if required) | *Not set* | +| INVENTREE_DB_PASSWORD | database.PASSWORD | Database password (if required) | *Not set* | +| INVENTREE_DB_HOST | database.HOST | Database host address (if required) | *Not set* | +| INVENTREE_DB_PORT | database.PORT | Database host port (if required) | *Not set* | +## Email Settings + +To enable [email functionality](../../admin/email), email settings must be configured here, either via environment variables or within the configuration file. + +The following email settings are available: + +| Environment Variable | Settings File | Description | Default | +| --- | --- | --- | --- | +| INVENTREE_EMAIL_BACKEND | email.backend | Email backend module | django.core.mail.backends.smtp.EmailBackend | +| INVENTREE_EMAIL_HOST | email.host | Email server host | *Not set* | +| INVENTREE_EMAIL_PORT | email.port | Email server port | 25 | +| INVENTREE_EMAIL_USERNAME | email.username | Email account username | *Not set* | +| INVENTREE_EMAIL_PASSWORD | email.password | Email account password | *Not set* | +| INVENTREE_EMAIL_TLS | email.tls | Enable TLS support | False | +| INVENTREE_EMAIL_SSL | email.ssl | Enable SSL support | False | ## Allowed Hosts / CORS diff --git a/mkdocs.yml b/mkdocs.yml index 27a368a..06e8610 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -90,6 +90,7 @@ nav: - Import Data: admin/import.md - Python Shell: admin/shell.md - Error Logs: admin/logs.md + - Email: admin/email.md - Background Tasks: admin/tasks.md - Extend: - API: extend/api.md From 2cf1c858b748ee9d7e5a58fc91f35de4c8f3e99f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 13 Apr 2021 20:24:07 +1000 Subject: [PATCH 3/3] update release notes --- docs/releases/0.2.1.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/releases/0.2.1.md b/docs/releases/0.2.1.md index 879123e..2e6af70 100644 --- a/docs/releases/0.2.1.md +++ b/docs/releases/0.2.1.md @@ -8,6 +8,13 @@ title: Release 0.2.1 ## New Features +### Email Support + +[#1304](https://github.com/inventree/InvenTree/pull/1304) adds support for email support. Initially, this is used for sending users emails to perform a password reset + +!!! warning "Configuration Required" + Refer to the [email configuration options](../../start/config/#email-settings). + ## Major Bug Fixes | PR | Description |