Skip to content

Redesign Maple account emails in OpenSecret - #1114

Closed
doowta wants to merge 7 commits into
MaplePrivacyLabs:masterfrom
doowta:feat/maple-email-redesign
Closed

doowta wants to merge 7 commits into
MaplePrivacyLabs:masterfrom
doowta:feat/maple-email-redesign

Conversation

@doowta

@doowta doowta commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

  • Maple's account emails still use the layout from before the rebrand. Update Maple account emails #1018 updated the mark, naming and links, but not the design.
  • Today's welcome email loads its product photo from blog.trymaple.ai on Ghost. That image breaks when the blog moves off Ghost.
  • Codes, verification links and warnings should stay clear on phones, in dark mode, and when images are blocked.

What this PR adds

  • The six Maple account emails in the new Maple design: responsive cards, dark-mode styling, and Outlook fallbacks.
  • Current marketing links with aggregate UTM tags, and image URLs under https://img.maple.ai/email/. Verification links, timing, sender, reply-to, and support addresses stay the same.
  • Tests that prove non-Maple projects and the platform emails are unchanged, byte for byte.

Account emails at desktop

Email Before (master) After
Welcome
Hero, device photo, Pro list, and Proxy card.
Welcome email before Welcome email after
Verify your account
Verification button, code, fallback URL, and 24-hour expiry.
Verification email before Verification email after
Reset your password
Code box and expiry notice.
Password reset email before Password reset email after
Password reset confirmation
Clear confirmation and recovery advice.
Password reset confirmation before Password reset confirmation after
Account deletion code
Confirmation code and permanent-action warning.
Account deletion code email before Account deletion code email after
Account deleted
Final confirmation and support contact.
Account deleted email before Account deleted email after

Welcome in light and dark

View Light Dark
Desktop, 800 px
Card contrast and the footer watermark.
Welcome desktop light Welcome desktop dark
Phone, 390 px
Readable cards, aligned Pro features, and footer.
Welcome phone light Welcome phone dark
Details for reviewers (scope, safety, checks, deployment)

Files

All paths below are under services/opensecret/.

File Purpose
src/email.rs Maple-only selection, existing account sends, link/branding tests, escaping and non-Maple regression tests.
src/email/maple_templates.rs Renders the six templates with escaped values; one https://img.maple.ai/email/ image base constant.
src/email/maple_templates/layout.html Shared header, footer, fluid layout, dark mode, and Outlook wrapper.
src/email/maple_templates/{welcome,verification,password-reset,password-reset-confirmation,account-deletion,account-deletion-confirmation}.html The six Maple bodies.
src/email/non_maple_snapshots/*.json Pre-edit subjects and HTML for the five non-Maple account emails.
scripts/compare_maple_emails.py Compares Rust HTML against build.py production HTML with fixed values.

The templates are generated from Maple's email design source (build.py, outside this repo). scripts/compare_maple_emails.py checks that the Rust output matches it exactly.

Scope and safety

  • is_maple_project() selects the redesign only when the project name is exactly Maple. Non-Maple welcome mail remains unsent, as before. The other five non-Maple emails keep their original subjects and HTML; non_maple_html_matches_pre_edit_snapshots checks byte-for-byte snapshots taken before this branch's edits.
  • The four send_platform_* function bodies were compared with master (de44a30) and are byte-identical. Their senders, subjects, reply-to behavior, and HTML are unchanged.
  • Sender display name, reply-to and support addresses, Resend payload shape, verification URLs and codes, 24-hour expiry wording, and the welcome email's five-minute schedule remain in place. build.py supplies HTML only, with no plain-text versions to send as a Resend text field. No live Resend send was made.
  • escape_html covers &, <, >, both quotes, and apostrophes before dynamic project/org names, codes, support addresses, and verification URLs enter HTML. The template fill is single-pass, so input containing {{...}} cannot introduce another template field. Tests include a hostile name and a URL containing "<>&.

Subjects

Email Before After
Welcome Welcome to Maple! Welcome to Maple
Verify your account Verify Your Maple Account Verify your Maple account
Reset your password Reset Your Maple Password Reset your Maple password
Password reset confirmation Your Maple Password Has Been Reset Your Maple password was changed
Account deletion code Account Deletion Request for Your Maple Account Confirm your Maple account deletion
Account deleted Your Maple Account Has Been Deleted Your Maple account has been deleted

Preheaders

The old templates had no explicit preheaders. The new hidden preheaders are:

Email Preheader
Welcome Your private space for real conversations is ready.
Verify your account Confirm your email to finish setting up. The link expires in 24 hours.
Reset your password Your code is {code}. It expires in 24 hours.
Password reset confirmation If this was you, you're all set. If not, contact us right away.
Account deletion code Enter the code in the app to confirm. This can't be undone.
Account deleted Your account and its data have been permanently removed.

Links and click counts

  • Welcome: See plans goes from /research#pricing to https://www.trymaple.ai/pricing; Download the app goes from /research#download to https://www.trymaple.ai/downloads. Details stays on /research, Read the docs stays on /docs/proxy, and Start your first chat stays on https://trymaple.ai.
  • Footer GitHub now goes directly to https://github.com/MaplePrivacyLabs/Maple instead of the redirecting OpenSecretCloud/Maple URL.
  • The pricing, downloads, research, Proxy docs, footer home, and footer Privacy links use utm_source=email, utm_medium=email, and a campaign/content pair. Campaigns are welcome, verify-email, password-reset, password-changed, delete-account, and account-deleted; content slugs are see-plans, download-app, details, proxy-docs, footer-home, and footer-privacy as applicable. A single build.py helper validates values against [a-zA-Z0-9._-]{1,100} and writes &amp; between query parameters. The Rust link tests assert the exact resulting hrefs.
  • The app and verification URLs, mailto, GitHub, X, and the wordmark link have no UTM tags. Resend click tracking and link wrapping remain off; these tags let Umami count aggregate clicks.

Images and layout

  • Account images use one Rust base constant, https://img.maple.ai/email/, with flat filenames. The six account templates reference these 11 files: app-icon.png, wordmark.png, footer-watermark-light.png, footer-watermark-dark.png, research-laptop.jpg, tile-welcome.png, tile-verify.png, tile-reset.png, tile-reset-done.png, tile-delete.png, and tile-deleted.png.
  • The welcome laptop photo has meaningful alt text in Manrope, with a color that follows the card in light and dark mode. The app icon and footer watermarks retain empty decorative alt text. Hero images have readable alt text over their cell colors when images are blocked. There are no tracking pixels.
  • The container is fluid up to 600 px. At 600 px and below, stacking and the side-padding reset apply together; at 390 and 320 px the cards remain within the viewport. A 600 px MSO ghost table and numeric image widths protect Word-based Outlook. Inline code sizing remains phone-safe if a client strips <style>.
  • Dark colors and the footer watermark swap use prefers-color-scheme, with an Outlook.com dark-mode selector as well. Gmail clients that ignore dark-mode image swaps may show the light watermark; the content and alt text remain readable. Screenshots are Chrome renders from Rust HTML, with image paths pointed at local copies only for rendering. Desktop “Before” uses the current master templates (unchanged since f8ab3e5; the branch is rebased on de44a30).

Checks

From services/opensecret/, with stateful shell hooks disabled:

OPENSECRET_DEV_POSTGRES=0 OPENSECRET_DEV_ENV=0 OPENSECRET_DEV_CONTAINERS=0 nix develop --no-write-lock-file '.?submodules=1' -c env MAPLE_EMAIL_DUMP_DIR=/tmp/maple-rust-html RUSTFLAGS='-D warnings' cargo test --locked --all-features email::tests -- --nocapture
python3 scripts/compare_maple_emails.py <path-to>/email-previews/build.py /tmp/maple-rust-html
OPENSECRET_DEV_POSTGRES=0 OPENSECRET_DEV_ENV=0 OPENSECRET_DEV_CONTAINERS=0 nix develop --no-write-lock-file '.?submodules=1' -c cargo fmt --all -- --check
OPENSECRET_DEV_POSTGRES=0 OPENSECRET_DEV_ENV=0 OPENSECRET_DEV_CONTAINERS=0 nix develop --no-write-lock-file '.?submodules=1' -c env RUSTFLAGS='-D warnings' cargo clippy --locked --all-targets --all-features -- -D warnings
OPENSECRET_DEV_POSTGRES=0 OPENSECRET_DEV_ENV=0 OPENSECRET_DEV_CONTAINERS=0 nix develop --no-write-lock-file '.?submodules=1' -c env RUSTFLAGS='-D warnings' cargo test --locked --all-features
  • Focused email tests: 6 passed. Rust versus build.py production HTML: exact byte match for all six emails. Pinned format and Clippy: passed. Full test gate on the rebased branch: 789 passed, 0 failed, 31 ignored.
  • Chrome rendered every PR image from its stated HTML source; all image requests loaded. Earlier light/dark, 320/390/520/600/800 px, Outlook-structure, and style-stripped checks passed during the layout revisions.
  • The 31 ignored tests need disposable database or live provider conditions and were not run here. No linked encrypted local stack, live Resend send, enclave build, deployment, or hosted-client check was run for this presentation-only change.

Deployment and domain move

  • Takes effect with the next OpenSecret release. The images are already live at https://img.maple.ai/email/ (all 11 return 200 with immutable caching); they must stay there permanently, because sent emails keep loading them.
  • The app and verification links still use trymaple.ai; marketing pages use www.trymaple.ai, and images use https://img.maple.ai/email/. A later app-domain move must keep redirects for links already sent in email. This PR does not move those app URLs.

Merge

Squash.

Copy link
Copy Markdown
Contributor

Thanks for this, @doowta. The redesign is a big step up from our old account emails, and the dark mode, Outlook and phone work really shows. Here's our review feedback.

Keeping as-is

  • The templates stay as include_str! HTML files. They compile into the binary, the Nix package filter includes everything under src/, and CI's package build passed on a8cbaca.
  • Maple-only selection, unchanged non-Maple and platform mail, and the non-Maple snapshots.
  • The img.maple.ai/email/ images, the copyright line and the Austin address.

Changes before merge

  1. Remove the Python comparison. Drop scripts/compare_maple_emails.py and the dump_maple_html_for_preview_comparison test. They depend on build.py, which lives outside this repo, so neither CI nor other contributors can run them. The HTML in this repo should be the source of truth.

  2. No panics in the email path. fill() panics on an unknown or unterminated placeholder (maple_templates.rs:46, :51). Rendering should return a Result, with no panic!, expect or unwrap anywhere in it. If it ever fails, that one send fails cleanly instead of panicking inside the enclave.

  3. Unit tests on the templating logic itself, including the Maple/non-Maple switch. That switch lives inside the async send functions, which need the database and Resend, so no test exercises it today. Subject and HTML selection should move into a pure function that the send functions call. Tests should cover:

    • every email, for project Maple (new subject and HTML) and for any other project (legacy subject and HTML, byte-identical to the snapshots);
    • every email kind rendering without error and leaving no {{ or }} behind, iterated from an exhaustive list so a new kind can't skip the test;
    • fill on its own: unknown and unterminated placeholders, values containing {{…}} never being expanded, and placeholders that are adjacent or at the start or end.

    Placeholder parsing only reads the template text, never the values. So rendering each kind once in a test proves it can't fail at runtime for any input.

  4. Only render the email we send. Each send function builds the legacy HTML and then discards it for Maple (email.rs:432, :494, :551, :895, :952). Legacy rendering belongs only on the non-Maple path.

  5. No dead code. MAPLE_MARK_HTML, account_mark_html and the mark argument now only feed that discarded output, so they go. Non-Maple output stays byte-identical, and the snapshots prove it.

  6. Footer year in UTC. Use Utc::now() instead of Local::now() (maple_templates.rs:133).

  7. No reset code in the preheader. Your code is {code}… (maple_templates.rs:84) puts the reset code on lock screens, watches and inbox previews. The preview text should be code-free, like the verification and deletion emails.

  8. Self-host Manrope instead of loading Google Fonts. Manrope is our brand face, so it stays. But no Maple app loads fonts from Google; Research and the auth site ship their own Manrope-VariableFont_wght.ttf. The fonts.googleapis.com link (layout.html:10) would send every reader's IP to Google when they open the email. Serve the font from the same R2 bucket, with Access-Control-Allow-Origin: * as Google does, and load it with @font-face instead.

All of this ships in the enclave build, so we're going to take the PR over from here and make these changes ourselves. Nothing more is needed from you. Thanks again, you've made our emails a lot better.


Generated by Claude Code

Copy link
Copy Markdown
Contributor

Continuing this in #1142, which keeps your 7 commits as-is and adds the review changes on top. Closing this one in favor of it. Thanks again, @doowta!


Generated by Claude Code

Copy link
Copy Markdown
Contributor

@doowta, here's where your redesign landed. We took it over in #1142, which keeps your 7 commits as-is and adds one commit on top.

Code changes (from the review above)

  • Rendering returns an error instead of panicking. Every {{NAME}} placeholder is checked at compile time, so a misspelled or unclosed one fails the build.
  • One pure function, account_message, picks your templates or the original ones for each project and renders only the email that's sent. It's unit-tested for every email, and other projects' emails are byte-identical to before.
  • Removed compare_maple_emails.py and the HTML-dump test; the HTML in the repo is now the source of truth.
  • The footer year is in UTC, and the reset code is out of the preview text.
  • Manrope now loads from our bucket instead of Google Fonts. It's an @font-face in its own <style> block, hidden from Word-based Outlook.

What we added to the img.maple.ai bucket

  • Font: email/manrope-variable.woff2 (54,320 bytes), built from apps/maple-research/frontend/public/fonts/Manrope-VariableFont_wght.ttf.
    • Served as font/woff2 with Cache-Control: public, max-age=31536000, immutable.
    • Uploaded with If-None-Match: * so it can't be overwritten. Like your images, it has to stay there permanently.
  • CORS: a bucket rule allowing origins *, methods GET and HEAD, headers *, max age 86400. Mail clients need this to use the font. There were no CORS rules before.

Cloudflare settings we changed for img.maple.ai

  • Browser Integrity Check was returning 403 to non-browser clients such as Python's default user agent. That risked blocking mail providers' image proxies.
  • A configuration rule now covers only img.maple.ai GET, HEAD and OPTIONS requests. It turns off Browser Integrity Check and hotlink protection and sets the security level to essentially off. Other hostnames and DDoS protection are unchanged.
  • Python and the Gmail, Yahoo and Apple Mail proxy user agents now get 200 for the wordmark and the font.
  • Cloudflare had cached a 404 for the font URL from a request made before the upload, so we purged it. When adding new email assets, upload them before anything references them.

Still to do: a real test send to Gmail, Outlook.com, Yahoo and Apple Mail once this is on Dev.

Thanks again for the redesign!


Generated by Claude Code

AnthonyRonning added a commit that referenced this pull request Oct 11, 2026
Maple's six account emails in the new design, from #1114, with images
and the Manrope font served from img.maple.ai.

- Rendering is panic-free, and template placeholders are checked at
  compile time.
- account_message picks Maple's redesign or the original HTML and
  renders only the email that is sent; unit tests cover the switch.
- Other projects' emails and platform emails are unchanged.
- The password-reset code stays out of the preview text.

Co-authored-by: Michael Atwood <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YVmVPWXRLVo83Zxnu5ES1P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants