diff --git a/docker-compose.yml b/docker-compose.yml index 4423dd23b..dd0d06daf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,11 @@ services: test: ["CMD", "redis-cli","ping"] interval: 1s + mailpit: + image: axllent/mailpit:v1.27 + ports: + - "8025:8025" + web: build: context: . @@ -33,11 +38,16 @@ services: environment: DATABASE_URL: postgresql://pythondotorg:pythondotorg@postgres:5432/pythondotorg DJANGO_SETTINGS_MODULE: pydotorg.settings.local + EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend + EMAIL_HOST: mailpit + EMAIL_PORT: 1025 depends_on: postgres: condition: service_healthy redis: condition: service_healthy + mailpit: + condition: service_started worker: image: pythondotorg:docker-compose @@ -47,8 +57,13 @@ services: environment: DATABASE_URL: postgresql://pythondotorg:pythondotorg@postgres:5432/pythondotorg DJANGO_SETTINGS_MODULE: pydotorg.settings.local + EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend + EMAIL_HOST: mailpit + EMAIL_PORT: 1025 depends_on: postgres: condition: service_healthy redis: condition: service_healthy + mailpit: + condition: service_started diff --git a/docs/source/install.md b/docs/source/install.md index 3c82b7571..252a1b405 100644 --- a/docs/source/install.md +++ b/docs/source/install.md @@ -57,6 +57,8 @@ web_1 | Quit the server with CONTROL-C. You can view these results in your local web browser at: +Emails sent by the site (account verification, nomination confirmations, etc.) are caught by [Mailpit](https://mailpit.axllent.org/) and can be read at . + To reset your local environment, run: ``` diff --git a/pydotorg/settings/local.py b/pydotorg/settings/local.py index e93395bc5..a89fb84a7 100644 --- a/pydotorg/settings/local.py +++ b/pydotorg/settings/local.py @@ -22,7 +22,10 @@ }, } -EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" +# docker-compose points these at Mailpit; outside Docker, mail prints to the console. +EMAIL_BACKEND = config("EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend") +EMAIL_HOST = config("EMAIL_HOST", default="localhost") +EMAIL_PORT = config("EMAIL_PORT", default=25, cast=int) try: