Skip to content

MSO conditional comments in <head> use non-standard <![endif]/--> closing that breaks Classic Outlook #403

@sQVe

Description

@sQVe
  • Component or Package Name: jsx-email (renderer/conditional.ts)
  • Component or Package Version: 2.8.4
  • @jsx-email/cli Version?: 2.8.4
  • Operating System (or Browser): Linux / Classic Outlook 2019, Outlook 365 desktop
  • Node Version: 24.13.0
  • Link to reproduction (⚠️ read below): Not relevant

Expected Behavior

MSO conditional comments in the <head> section should use the standard closing syntax <![endif]-->:

<!--[if mso]><xml><o:OfficeDocumentSettings><o:AllowPNG /><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->

Actual Behavior

MSO conditional comments in the use non-standard closing syntax <![endif]/-->:

<!--[if mso]><xml><o:OfficeDocumentSettings><o:AllowPNG /><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]/-->

Note the trailing / before -->. This causes Classic Outlook (2007-2019, Office 365 desktop) to fail to parse the conditional, resulting in emails not rendering at all.

Additional Information

The issue is in src/renderer/conditional.ts where there's intentional logic to use <![endif]/--> for head conditionals:

// when adjacent comments appear. Use the `<![endif]/-->` form
closeRaw = '<![endif]/-->';

However, <![endif]/--> is not valid IE/Outlook conditional comment syntax. The standard closing is <![endif]-->. Classic Outlook's Word rendering engine doesn't recognize the non-standard form.

Workaround:

const html = await render(<Email />);
const fixed = html.replaceAll('<![endif]/-->', '<![endif]-->');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions