Skip to content

[Bug]: Responsive 600px email tables are stretched to full viewer width #790

Description

@Dimaon

Description

Bulwark overrides an email's explicit inline max-width on tables, which stretches a standard centered 600px responsive email layout to the full width of the message viewer.

The iframe stylesheet currently contains:

table {
  max-width: 100% !important;
  table-layout: auto;
  overflow-wrap: break-word;
}

Source: https://github.com/bulwarkmail/webmail/blob/main/components/email/email-viewer.tsx#L2224

Because this declaration is !important, it overrides a normal inline declaration such as max-width: 600px. If the same table also uses width: 100% (a common responsive-email pattern), its effective maximum becomes the full iframe width.

Steps to Reproduce

  1. Send or import an HTML email with this minimal layout:
<!doctype html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <table role="presentation" width="100%" style="width: 100%;">
      <tr>
        <td align="center">
          <table
            role="presentation"
            align="center"
            style="width: 100%; max-width: 600px; margin: 0 auto;"
          >
            <tr>
              <td style="padding: 24px; background: #f3f3f3;">
                Centered 600px email content
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </body>
</html>
  1. Open the message in Bulwark Webmail on a viewport wider than 600px.
  2. Observe that the inner content table expands to the full viewer width.

Expected Behavior

The inner content table remains centered and no wider than 600px, while shrinking responsively on viewports narrower than 600px.

Actual Behavior

The inner table expands to the full available width of the email viewer. The same message keeps its intended 600px maximum width in other tested mail clients.

Bulwark Version

1.8.1

Stalwart Mail Server Version

No response

Browser

No response

Operating System

None

Screenshots / Screen Recording

No response

Relevant Logs or Error Output

Additional Context

The conflicting rule is also present in the current main branch as of 2026-08-12.

Verified workaround

Adding an explicit HTML width attribute and fixed inline width prevents the stretching:

<table
  role="presentation"
  width="600"
  align="center"
  style="width: 600px; max-width: 100%; margin: 0 auto;"
>

This workaround was verified in Bulwark 1.7.8, but email senders should not need to change an otherwise standard responsive table layout specifically for this client.

Possible direction

Avoid overriding an email author's explicit table max-width with !important. Removing !important, or applying the safety cap only when the table has no narrower author-defined maximum, would preserve responsive layouts while retaining overflow protection for genuinely wide tables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions