You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Email preview renders in Quirks Mode — DOCTYPE is lost in the dashboard iframe #5
I wanted to show system emails in testing for my testers and noticed a rendering problem:
The HTML preview in the MailWeb dashboard renders emails slightly differently than mail clients (and than MailWeb's own share view). Typical symptoms are the classic Quirks Mode artifacts in table-based email layouts: small gaps below images, different line heights and table cell spacing.
Rendering in preview tab (wrong)
Rendering via share button view (correct)
Cause
In resources/js/components/EmailPreview.vue, updateIframe() parses the stored HTML with DOMParser and then writes emailDoc.documentElement.outerHTML into the iframe via document.write():
documentElement.outerHTML only serializes the element — the declaration is dropped. A document written without a doctype renders in Quirks Mode, which changes layout behavior exactly in the ways email templates are
sensitive to (inline images on the text baseline, table spacing, etc.).
The public share view does not have this problem because email-share.blade.php passes the original HTML straight through:
Send any email built with a table-based layout and a full header (e.g. a classic 600px transactional template with header images).
Open it in the MailWeb dashboard → Preview tab.
Compare with the share view of the same email (or with Mailpit/a mail client): the dashboard preview shows small rendering differences (image gaps, spacing).
Inspect the preview iframe: document.compatMode is "BackCompat" (Quirks Mode) instead of "CSS1Compat".
Suggested fix
Serialize the doctype along with the document, or avoid the re-serialization entirely — e.g.:
Activity
Preserve DOCTYPE in email preview iframe (fixes appoly#5)