From 85369914c81a7d6d4d2b1a20317c27850bd9be46 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Fri, 7 Aug 2026 08:17:31 -0700 Subject: [PATCH] Quote DEFAULT_FROM_EMAIL display name so contact mail sends (#29) ## Summary - Closes #28 - Quote `DEFAULT_FROM_EMAIL` display name (`"AI ML Operations, LLC" `) so RFC 5322 From parsing succeeds - Update settings default, email send fallbacks, and `.env` examples ## Problem Contact form saved leads but notification email to `ryan@aimloperations.com` failed with: ``` Invalid address; only AI ML Operations could be parsed from "AI ML Operations, LLC " ``` Comma in unquoted display name treated as address-list separator. ## Test plan - [ ] Submit contact form in an environment with SMTP configured - [ ] Confirm lead appears on leads page - [ ] Confirm email arrives at ryan@aimloperations.com - [ ] If prod sets `DEFAULT_FROM_EMAIL` in `.env`, ensure that value is also quoted before deployReviewed-on: https://git.aimloperations.com/ai_ml_operations/company_site/pulls/29 --- .env.example | 4 ++-- .env.prod.example | 3 ++- company_site/company_site/settings/base.py | 2 +- company_site/financial/stripe_billing.py | 2 +- company_site/public/admin.py | 2 +- company_site/public/views.py | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index c265784..b396e86 100644 --- a/.env.example +++ b/.env.example @@ -33,10 +33,10 @@ EMAIL_HOST_USER= EMAIL_HOST_PASSWORD= EMAIL_PORT=2525 EMAIL_USE_TLS=true -# DEFAULT_FROM_EMAIL=AI ML Operations, LLC +# Display name has a comma — must be quoted (RFC 5322) +# DEFAULT_FROM_EMAIL="AI ML Operations, LLC" # Absolute origin for email logo / footer links PUBLIC_SITE_URL=https://aimloperations.com -# DEFAULT_FROM_EMAIL=AI ML Operations, LLC # Stripe (test keys from https://dashboard.stripe.com/test/apikeys) STRIPE_SECRET_KEY= diff --git a/.env.prod.example b/.env.prod.example index 7f36165..80431fd 100644 --- a/.env.prod.example +++ b/.env.prod.example @@ -34,7 +34,8 @@ EMAIL_HOST_USER=replace-with-smtp-user EMAIL_HOST_PASSWORD=replace-with-smtp-password EMAIL_PORT=2525 EMAIL_USE_TLS=true -# DEFAULT_FROM_EMAIL=AI ML Operations, LLC +# Display name has a comma — must be quoted (RFC 5322) +# DEFAULT_FROM_EMAIL="AI ML Operations, LLC" PUBLIC_SITE_URL=https://aimloperations.com # Stripe (live keys from https://dashboard.stripe.com/apikeys) diff --git a/company_site/company_site/settings/base.py b/company_site/company_site/settings/base.py index e9bc973..a7f1f85 100644 --- a/company_site/company_site/settings/base.py +++ b/company_site/company_site/settings/base.py @@ -202,7 +202,7 @@ EMAIL_PORT = int(env("EMAIL_PORT", "2525")) EMAIL_USE_TLS = env_bool("EMAIL_USE_TLS", True) DEFAULT_FROM_EMAIL = env( "DEFAULT_FROM_EMAIL", - "AI ML Operations, LLC ", + '"AI ML Operations, LLC" ', ) # Absolute site origin for email logo / footer links (no trailing slash). PUBLIC_SITE_URL = env("PUBLIC_SITE_URL", "https://aimloperations.com").rstrip("/") diff --git a/company_site/financial/stripe_billing.py b/company_site/financial/stripe_billing.py index 0803a02..d174a93 100644 --- a/company_site/financial/stripe_billing.py +++ b/company_site/financial/stripe_billing.py @@ -282,7 +282,7 @@ def send_pay_link_email( from_email = getattr( settings, "DEFAULT_FROM_EMAIL", - "AI ML Operations, LLC ", + '"AI ML Operations, LLC" ', ) from public.email_branding import email_brand_context diff --git a/company_site/public/admin.py b/company_site/public/admin.py index 1ee7a46..e1f434e 100644 --- a/company_site/public/admin.py +++ b/company_site/public/admin.py @@ -41,7 +41,7 @@ def send_emails(modeladmin, request, queryset): from_email = getattr( settings, "DEFAULT_FROM_EMAIL", - "AI ML Operations, LLC ", + '"AI ML Operations, LLC" ', ) d = email_brand_context(title=email.subject, content=email.body) diff --git a/company_site/public/views.py b/company_site/public/views.py index 931e14a..623b364 100755 --- a/company_site/public/views.py +++ b/company_site/public/views.py @@ -25,7 +25,7 @@ def send_contact_email(email, subject, message): from_email = getattr( settings, "DEFAULT_FROM_EMAIL", - "AI ML Operations, LLC ", + '"AI ML Operations, LLC" ', ) to = "ryan@aimloperations.com" d = email_brand_context(subject=subject, message=message, email=email)