Skip to content

Commit aa9b9f9

Browse files
author
hamin
committed
mail auth update
1 parent 4363097 commit aa9b9f9

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Config(object):
4444
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
4545
MAIL_USE_SSL = os.environ.get('MAIL_USE_SSL') is not None
4646
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
47+
MAIL_USER = os.environ.get('MAIL_USER')
4748
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
4849
# print("MAIL PASSWORD", MAIL_PASSWORD)
4950
INSTANCE = os.environ.get('INSTANCE') or "PRODUCTION"

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ services:
8080
- INSTANCE=(DEV)
8181
8282
83+
- MAIL_USER=${MAIL_USER}
8384
# - MAIL_PORT=465 # comment if using the dev server
8485
# - MAIL_USE_TLS=1 # comment if using the dev server
8586
labels:

myapp/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@
5151
if not app.debug:
5252
if app.config['MAIL_SERVER']:
5353
auth = None
54-
if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
54+
# Commented as authentication method changed
55+
# if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
56+
# auth = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
57+
if app.config['MAIL_USER'] and app.config['MAIL_PASSWORD']:
58+
auth = (app.config['MAIL_USER'], app.config['MAIL_PASSWORD'])
59+
elif app.config['MAIL_USERNAME'] and app.config['MAIL_PASSWORD']:
5560
auth = (app.config['MAIL_USERNAME'], app.config['MAIL_PASSWORD'])
5661
secure = None
5762
if app.config['MAIL_USE_TLS']:

0 commit comments

Comments
 (0)