6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-04 20:37:52 +00:00

Make sure all emails are stored to a tmp file in development

In development, emails sent from edx-platform were using the
"file_email" channel from edx-ace ("edX's automated communication
engine"). This channel was failing because it tries to write to a file
located in the /edx folder, which does not exist in tutor containers. To
fix this, we configure edx-ace to rely on the django email backend,
which itself is configured to send emails to a file in development. It
turns out that this backend was also configured to store emails in a
file located in the /edx folder, so we had to add the standard
EMAIL_FILE_PATH django setting to our development settings.

It was easier to reconfigure the django file email backend than the
edx-ace file_email channel because the output path of the latter cannot
be modified by a setting.

Note that this causes all emails to be stored in local files instead of
being sent to actual recipients. This is the default behaviour in Open
edX, and indeed in most default django apps (in development). This is a
good thing! If, for some reason, developers would like to try out email
sending during development, they should modify the EMAIL_BACKEND
setting and set it to 'django.core.mail.backends.smtp.EmailBackend'.
This is quite easy to achieve with the help of a plugin:

    name: sendemailsindev
    version: 0.1.0
    patches:
      openedx-development-settings: |
          # actually send emails in dev
          EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

Close #315
This commit is contained in:
Régis Behmo 2020-04-15 23:38:31 +02:00
parent 072c3a1a15
commit 724c2c84da
2 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Make sure all emails (including "password reset") are properly saved to a local file in development mode (#315)
- [Improvement] Add `openedx-development-settings` patch to patch the LMS and the CMS simultaneously in development
- [Bugfix] Fix missing celery tasks in the CMS

View File

@ -37,7 +37,13 @@ LOGGING["handlers"]["tracking"] = {
}
LOGGING["loggers"]["tracking"]["handlers"] = ["console", "local", "tracking"]
# Email
EMAIL_USE_SSL = {{ SMTP_USE_SSL }}
# Forward all emails from edX's Automated Communication Engine (ACE) to django.
ACE_ENABLED_CHANNELS = ["django_email"]
ACE_CHANNEL_DEFAULT_EMAIL = "django_email"
ACE_CHANNEL_TRANSACTIONAL_EMAIL = "django_email"
EMAIL_FILE_PATH = "/tmp/openedx/emails"
LOCALE_PATHS.append("/openedx/locale")