Merge pull request #115 from clmcavaney/from-address

adding SMTP_FROM_ADDRESS for email From address
This commit is contained in:
sassanix
2025-08-22 08:34:57 -03:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -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')

View File

@@ -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}

View File

@@ -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
# https://github.com/caronc/apprise/wiki