feat: add branded email templates with local preview (#606)#963
Open
snehxa27 wants to merge 1 commit into
Open
feat: add branded email templates with local preview (#606)#963snehxa27 wants to merge 1 commit into
snehxa27 wants to merge 1 commit into
Conversation
Introduce reusable Jinja2 transactional email templates with premailer CSS inlining, dev preview routes, welcome email on signup, and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves #606 by replacing plain-text and inline HTML emails with reusable, branded transactional templates. All emails share a consistent QyverixAI visual identity (purple header, dark content area, light footer) and are rendered through a single Jinja2 + premailer pipeline in
email_service.py.What changed:
backend/app/templates/email/—base.html,welcome.html,reset.html,notification.html, anddigest.htmlemail_service.pyto userender_template()with premailer CSS inlining for Gmail/Outlook compatibilityMotivation
Transactional emails previously lacked branding and consistent styling. This made system notifications harder to recognize and reduced perceived product quality. A template-based approach with a local preview mechanism lets contributors design and review emails quickly while keeping production sends email-client safe.
Implementation details
Templates
All templates extend
base.html, which provides:welcome.htmlreset.htmlnotification.htmldigest.htmlemail_service.pyrender_template(name, context)— Jinja2 render + optional premailer inliningsend_welcome_email(),send_password_reset_email(),send_notification_email(),send_digest()compute_subscriber_stats()extended with weekly score history, sparklines, and recommendationsPreview routes (development only)
Disabled when
ENVIRONMENT=production.GET /email-previewGET /email-preview/{template}GET /dev/email-preview/{template}/devprefixCommon URL typos (e.g.
welcom) redirect to the correct template.Other changes
auth.py— sends welcome email in background after successful signupconfig.py— addsENVIRONMENTsetting andis_productionhelperrequirements.txt— addsjinja2andpremailer.env.example— documentsENVIRONMENT=developmentHow to test
cd backend pip install -r requirements.txt pytest tests/test_email_templates.py tests/test_digest.py -v uvicorn app.main:app --reload