Or, on a phone, the Gmail app shows the same thing, a blank sheet, or
"No preview available".
The file isn't broken. You're looking at it in the wrong program.
Why Gmail never renders it
Gmail's attachment preview is a document viewer. It renders PDFs, images
and Office files; anything it doesn't render, it shows as text. HTML is
deliberately in the second group: rendering a stranger's page inside your
mailbox would let any sender run their own markup and scripts next to your
inbox, which is exactly what phishing kits want. So the preview shows the
source, and Gmail's own safety banner may warn about the attachment too.
The same is true one hop away. Google Drive's preview shows source,
and Open with → Google Docs imports the HTML as a document, dropping
the scripts and most of the styling. Neither shows the report as it was
built.
Check it away from your machine
See your page the way someone else will
Drop the HTML or paste it. It opens on a shareable page, so you can confirm the fix works for a reader, not just on your laptop.
Your file is read in this tab and nothing is uploaded until you publish. Creating an account is free, and reading a shared link never needs one.
Open it properly
On a computer. Use the download arrow on the attachment chip, not the
preview. Open the downloaded file with a browser: double-click it, drag it
onto a Chrome/Edge/Firefox/Safari window, or right-click → Open with. The
address bar shows file:///…/report.html and the page renders, scripts
and all. If it still shows tags, the file was saved as report.html.txt
— check the real extension.
On iPhone or iPad. Long-press the attachment in Gmail → Save to Files,
then open it from the Files app. Details and the limits of Quick Look in
open an HTML file on iPhone and
on iPad.
On Android. Download it, then open the Files app → Downloads →
the file → Open with → Chrome. Gmail's own preview won't hand it to a
browser — open an HTML file on Android.
Just want to look at it? Copy the source out of the preview and paste
it into the free HTML viewer. It renders in a
sandbox in your browser and nothing is uploaded.
When it opens but looks wrong
Getting it into a browser fixes the "code" problem. Two others are common
with emailed reports, because only one file made the trip:
You see
Why
Fix
Unstyled page, broken image icons
CSS and images were sibling files the sender didn't attach
The sender can fix all of these at once by bundling everything into one
file with the HTML inliner — or by not attaching
it at all.
If you're the sender: send a link
Every recipient who sees tags has to know the download-then-open dance,
on whatever device they read mail on. Most won't, and some never get the
file — Outlook and corporate gateways block HTML attachments
outright.
Publish the report and put the URL in the email instead:
One click from Gmail, on any device, rendered exactly as generated —
scripts, charts and styles run inside a sandbox.
No filter trouble. A link isn't an attachment, so nothing gets
quarantined or stripped, and there's no size limit to hit.
You choose who sees it: public, password, invite-only, or your email
domain — sharing options.
Replies land on the page. Readers pin comments to the exact chart
they mean, instead of replying-all with a screenshot. Commenting takes a
free sign-in, or none if you allow guest comments on the link.
Recurring report? Update the same report each run and the link in every
email keeps showing the latest version. See
emailing an HTML report and publish from CI.
Try it
Comma is free — unlimited reports and unlimited commenters.