diff --git a/backend/notifications.py b/backend/notifications.py index fa5677a..391adce 100644 --- a/backend/notifications.py +++ b/backend/notifications.py @@ -224,7 +224,11 @@ def format_expiration_email(user, warranties, get_db_connection, release_db_conn # Create a MIMEMultipart object for both text and HTML msg = MIMEMultipart('alternative') msg['Subject'] = subject - msg['From'] = os.environ.get('SMTP_USERNAME', 'notifications@warracker.com') + # use SMTP_FROM_ADDRESS if provided, otherwise use SMTP_USERNAME or a default value as below + _from_address = os.environ.get('SMTP_FROM_ADDRESS') + if _from_address is None: + _from_address = os.environ.get('SMTP_USERNAME', 'notifications@warracker.com') + msg['From'] = _from_address msg['To'] = user['email'] part1 = MIMEText(text_body, 'plain') diff --git a/docker-compose.yml b/docker-compose.yml index 3b9efd4..9a2908f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,8 @@ services: - SMTP_PORT=${SMTP_PORT:-1025} - SMTP_USERNAME=${SMTP_USERNAME:-notifications@warracker.com} - SMTP_PASSWORD=${SMTP_PASSWORD:-} + # if SMTP_FROM_ADDRESS isn't defined, then SMTP_USERNAME will be used - but that may not always work + - SMTP_FROM_ADDRESS=${SMTP_FROM_ADDRESS:-} - SECRET_KEY=${SECRET_KEY:-your_very_secret_flask_key_change_me} # For Flask session and JWT # OIDC SSO Configuration (User needs to set these based on their OIDC provider) - OIDC_PROVIDER_NAME=${OIDC_PROVIDER_NAME:-oidc} diff --git a/env.example b/env.example index ac23683..8a0cb8b 100644 --- a/env.example +++ b/env.example @@ -11,8 +11,9 @@ SECRET_KEY=your_very_secure_flask_secret_key_change_this_in_production # Email Configuration (for password resets and notifications) SMTP_HOST=smtp.gmail.com SMTP_PORT=587 -SMTP_USERNAME=your-email@gmail.com +SMTP_USERNAME=your-email-username SMTP_PASSWORD=your-app-password +SMTP_FROM_ADDRESS=your-email@somewhere.com SMTP_USE_TLS=true # Application URLs @@ -89,4 +90,4 @@ APPRISE_TITLE_PREFIX=[Warracker] # APPRISE_URLS=json://webhook.site/your-unique-id # For more services and URL formats, visit: -# https://github.com/caronc/apprise/wiki \ No newline at end of file +# https://github.com/caronc/apprise/wiki