Skip to content

Fix 124: Send Gmail bodies as HTML (multipart/alternative)#176

Merged
bmoss2015 merged 1 commit into
mainfrom
fix/gmail-html-real
Jun 19, 2026
Merged

Fix 124: Send Gmail bodies as HTML (multipart/alternative)#176
bmoss2015 merged 1 commit into
mainfrom
fix/gmail-html-real

Conversation

@bmoss2015

Copy link
Copy Markdown
Owner

Summary

The Gmail compose path in src/app/(app)/inbox/_send-actions.ts was passing the message body as bodyText only. buildRawMessage then emitted Content-Type: text/plain, so when a sender pasted HTML (or any tag-containing content) into the compose textarea, recipients saw raw <p>, <br>, <div> tags in the inbox.

This change builds both an HTML and a plain-text alternative and ships them as multipart/alternative:

  • If the body contains HTML tags, the HTML alt is the raw body and the plain alt is the tag-stripped version.
  • If the body is plain text, the HTML alt is HTML-escaped with \n<br>, the plain alt is the original.

HTML-capable clients render the formatted version; plain-text clients still see clean text.

PR #169 patched the else if (opts.bodyHtml) branch of buildRawMessage, but that branch was unreachable from the only caller (which passed bodyText). #169 can be closed.

Test plan

  • On the preview, compose an email with plain text only — recipient sees rendered text with intact newlines.
  • Compose an email with pasted HTML (e.g. <b>Hello</b>) — recipient sees rendered Hello, not raw tags.
  • Compose with an attachment — body still renders correctly alongside the attachment.
  • Reply to an existing thread — quoted > ... lines still render.

The Gmail compose path was passing the message body as bodyText only,
so buildRawMessage emitted Content-Type: text/plain and recipients saw
raw HTML tags when senders pasted formatted content. Now both an HTML
and a plain-text alternative are built and shipped multipart/alternative.
Plain-text input is escaped + newline-to-br so it still renders cleanly.
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moss-equity-portal Ready Ready Preview, Comment Jun 19, 2026 10:10pm

Request Review

@supabase

supabase Bot commented Jun 19, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project rsdmyydyhqgkkvwlklif because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@bmoss2015 bmoss2015 merged commit 9d5b467 into main Jun 19, 2026
4 checks passed
@bmoss2015 bmoss2015 deleted the fix/gmail-html-real branch June 19, 2026 22:37
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.

1 participant