🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
adding SMTP_FROM_ADDRESS for email From address
Christopher McAvaney982f86f60e49
diff --git a/backend/notifications.py b/backend/notifications.pyindex 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 HTMLmsg = MIMEMultipart('alternative')msg['Subject'] = subject- msg['From'] = os.environ.get('SMTP_USERNAME', '[email protected]')+ # 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', '[email protected]')+ msg['From'] = _from_addressmsg['To'] = user['email']part1 = MIMEText(text_body, 'plain')diff --git a/docker-compose.yml b/docker-compose.ymlindex 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:[email protected]}- 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.exampleindex 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.comSMTP_PORT=587+SMTP_USERNAME=your-email-usernameSMTP_PASSWORD=your-app-passwordSMTP_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