Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Email Feature] add relay smtp server configuration #1167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
version: "3.5"
services:
mailserver:
container_name: relay-smtp-mail-server
image: boky/postfix
environment:
ALLOWED_SENDER_DOMAINS: ${ALLOWED_SENDER_DOMAINS}
RELAYHOST: "smtp-relay.gmail.com:25"
networks:
- network
web:
build: .
container_name: pycontw-2024
Expand Down
3 changes: 2 additions & 1 deletion document/deploy_docker_prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ There are four configurations that must be set when running the container.
* `DATABASE_URL` specifies how to connect to the database (in the URL form
e.g. `postgres://username:password@host_or_ip:5432/database_name`)
* `EMAIL_URL` specifies how to connect to the mail server
(e.g. `smtp+tls://username:password@host_or_ip:25`)
(e.g. `smtp+tls://username:password@host_or_ip:25`, `smtp://host_or_ip:587` for local smtp server)
* `DSN_URL` specify how to connect to Sentry error reporting service
(e.g. `https://[email protected]/project`), please refer to
[Sentry's documentation on how to obtain Data Source Name](https://docs.sentry.io/error-reporting/quickstart/?platform=python)
* (optional) `ALLOWED_SENDER_DOMAINS` - Could be `python.tw` if we [route outgoing SMTP relay messages through Google](https://support.google.com/a/answer/2956491?hl=en)
* (optional) `GTM_TRACK_ID`
* (optional) `SLACK_WEBHOOK_URL`

Expand Down
14 changes: 7 additions & 7 deletions src/pycontw2016/settings/production/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@
'SentryResponseErrorIdMiddleware',
)

EMAIL_BACKEND = env.email_url()['EMAIL_BACKEND']
EMAIL_HOST = env.email_url()['EMAIL_HOST']
EMAIL_HOST_PASSWORD = env.email_url()['EMAIL_HOST_PASSWORD']
EMAIL_HOST_USER = env.email_url()['EMAIL_HOST_USER']
EMAIL_PORT = env.email_url()['EMAIL_PORT']
EMAIL_USE_TLS = env.email_url()['EMAIL_USE_TLS']
EMAIL_BACKEND = env.email_url().get('EMAIL_BACKEND')
EMAIL_HOST = env.email_url().get('EMAIL_HOST')
EMAIL_HOST_PASSWORD = env.email_url().get('EMAIL_HOST_PASSWORD')
EMAIL_HOST_USER = env.email_url().get('EMAIL_HOST_USER')
EMAIL_PORT = env.email_url().get('EMAIL_PORT')
EMAIL_USE_TLS = env.email_url().get('EMAIL_USE_TLS')

DEFAULT_FROM_EMAIL = SERVER_EMAIL = '{name} <{addr}>'.format(
name='PyCon Taiwan',
addr='web@pycon.tw',
addr='no-reply@python.tw',
)

# Securiy related settings
Expand Down
Loading