From 2f54fb33cd7eba23db21552f46de767ebacb4258 Mon Sep 17 00:00:00 2001 From: ameenahiqbal Date: Tue, 8 Sep 2026 15:10:59 +0530 Subject: [PATCH] email templates fix --- app/core/mail.py | 9 +- app/core/settings.py | 11 + app/templates/emails/document_shared.html | 698 +++++++++++++++- app/templates/emails/welcome.html | 953 +++++++++++++--------- 4 files changed, 1239 insertions(+), 432 deletions(-) diff --git a/app/core/mail.py b/app/core/mail.py index 803743f..5906601 100644 --- a/app/core/mail.py +++ b/app/core/mail.py @@ -44,7 +44,14 @@ def send_email( if template_name and template_context is not None and jinja_env: try: template = jinja_env.get_template(template_name) - html_body = template.render(**template_context) + # asset_base_url is injected for every template so image URLs follow + # the deployed frontend instead of being hardcoded. A call site can + # override it by passing its own value in template_context. + context = { + "asset_base_url": settings.EMAIL_ASSET_BASE_URL, + **template_context, + } + html_body = template.render(**context) if not body: body = f"Please view this email in an HTML-compatible client. Subject: {subject}" except Exception as e: diff --git a/app/core/settings.py b/app/core/settings.py index db3543e..81c422e 100644 --- a/app/core/settings.py +++ b/app/core/settings.py @@ -196,6 +196,17 @@ class Settings(BaseSettings): FRONTEND_URL: str = "http://localhost:5173" + @property + def EMAIL_ASSET_BASE_URL(self) -> str: + """Origin serving the email images in docqube_frontend/public/email/. + + These are frontend static assets, so they hang off FRONTEND_URL rather + than the API. FRONTEND_URL is a comma-separated list in some + environments (see .env.test), so take the first entry. + """ + base = self.FRONTEND_URL.split(",")[0].strip().rstrip("/") + return f"{base}/email" + LOG_LEVEL: str CORS_ORIGINS: str diff --git a/app/templates/emails/document_shared.html b/app/templates/emails/document_shared.html index 70063b0..8539ebd 100644 --- a/app/templates/emails/document_shared.html +++ b/app/templates/emails/document_shared.html @@ -1,54 +1,672 @@ - + + - Document Shared with You + + + + A Document is Ready for You + + + + + - -
-
-

DocQube

-
-
-

A document has been shared with you

+ +
+ -

- Hello {{ recipient_name }}, -

+ + + + + + + + + + +
- + \ No newline at end of file diff --git a/app/templates/emails/welcome.html b/app/templates/emails/welcome.html index 07fbf19..068dbe5 100644 --- a/app/templates/emails/welcome.html +++ b/app/templates/emails/welcome.html @@ -33,7 +33,7 @@ -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; font-family: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; - background-color: #EBF0F8; + background-color: #FFFFFF; color: #000000; } @@ -58,14 +58,14 @@ text-decoration: none; } - @media only screen and (max-width: 680px) { + @media only screen and (max-width: 789px) { .email-main-card { width: 100% !important; border-radius: 24px !important; } .header-section { - padding: 28px 18px 24px 18px !important; + padding: 24px 18px 24px 18px !important; border-top-left-radius: 24px !important; border-top-right-radius: 24px !important; } @@ -77,8 +77,7 @@ .feature-col { display: block !important; width: 100% !important; - border-right: none !important; - border-bottom: 1px solid #F1F5F9 !important; + border-bottom: 1px solid #E7EFFF !important; padding: 16px 8px !important; } @@ -86,6 +85,10 @@ border-bottom: none !important; } + .feature-divider { + display: none !important; + } + .footer-row { display: block !important; width: 100% !important; @@ -98,455 +101,624 @@ width: 100% !important; text-align: center !important; margin-bottom: 14px !important; + padding: 0 !important; } } - -
- - + +
+
- + - - + -