DEV Community

Tao Zhu
Tao Zhu

Posted on Originally published at mailpack.localledgerstudio.xyz

Fixing the Outlook Duplicate VML Button Bug, Gmail's 102 KB Clip, and 4 ESP Packaging Traps

It is 4:40 PM on a Friday. The launch email goes out Monday at 9:00 AM.

Three QA screenshots hit Slack in ten minutes. Classic Outlook on Windows is rendering two stacked "Claim Offer" buttons. Gmail clipped the footer right above the unsubscribe link with [Message clipped] View entire message. And Klaviyo just bounced the single .zip exported from Figma.

If you hand-code emails or convert Figma frames for Klaviyo, Braze, Mailchimp, or HubSpot, you have probably fought these exact bugs. Here is why each one happens, the copy-pasteable fix, and how to catch them locally before opening an ESP uploader.

1. The Outlook Duplicate Button VML Fix (Classic vs. New Outlook)

Outlook is now two completely different rendering engines behind one icon.

Classic Outlook for Windows (2016 to 2021 and Microsoft 365, supported through 2029) uses Microsoft Word. It ignores CSS border-radius and anchor padding, so rounded buttons still need VML (<v:roundrect>). New Outlook for Windows and Outlook on the Web run Chromium (WebView2). They render normal CSS and ignore <!--[if mso]> comments.

That split is why legacy VML button generators now break enterprise inboxes. Older snippets wrap <v:roundrect> inside <!--[if mso]>, then drop the modern HTML <a> button right after <![endif]--> with mso-hide:all; inline. Inside nested tables or forwarded threads, Classic Outlook frequently ignores mso-hide:all; and paints both the VML shape and the HTML link. You get two stacked buttons.

Leave <v:roundrect> outside <!--[if mso]> or mismatch a closing tag, and you get the mirror bug: raw VML leaking into Chromium and Gmail.

Step A: Declare VML namespaces and lock 96 DPI

Classic Outlook silently skips <v:roundrect> unless <html> declares Microsoft's VML and Office namespaces. On Windows laptops set to 125% or 150% display scaling, buttons also stretch unless <head> pins PixelsPerInch to 96:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:v="urn:schemas-microsoft-com:vml"
  xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <!--[if gte mso 9]>
  <xml>
    <o:OfficeDocumentSettings>
      <o:AllowPNG/>
      <o:PixelsPerInch>96</o:PixelsPerInch>
    </o:OfficeDocumentSettings>
  </xml>
  <![endif]-->
</head>
Enter fullscreen mode Exit fullscreen mode

Step B: Strictly isolate both buttons (mso vs. !mso)

Skip mso-hide:all. Put the VML button strictly inside <!--[if mso]> ... <![endif]-->, and put the HTML <a> button strictly inside <!--[if !mso]><!--> ... <!--<![endif]-->. Watch those extra <!--> and <!-- markers: Classic Outlook treats the entire !mso block as a comment, while New Outlook, Gmail, Apple Mail, and Yahoo render the <a> tag normally.

<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="center"
  style="border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;">
  <tr>
    <td align="center" style="padding:0;">
      <!--[if mso]>
      <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
        xmlns:w="urn:schemas-microsoft-com:office:word"
        href="https://example.com/offer"
        style="height:46px;v-text-anchor:middle;width:220px;"
        arcsize="17%" stroke="f" fillcolor="#0d99ff">
        <w:anchorlock/>
        <center style="color:#ffffff;font-family:Arial,Helvetica,sans-serif;font-size:15px;font-weight:700;">
          Claim Offer
        </center>
      </v:roundrect>
      <![endif]-->
      <!--[if !mso]><!-->
      <a href="https://example.com/offer" target="_blank"
        style="display:inline-block;background-color:#0d99ff;color:#ffffff;font-family:Arial,Helvetica,sans-serif;font-size:15px;font-weight:700;line-height:1.2;text-align:center;text-decoration:none;border-radius:8px;padding:14px 24px;min-width:172px;border:0;-webkit-text-size-adjust:none;">
        Claim Offer
      </a>
      <!--<![endif]-->
    </td>
  </tr>
</table>
Enter fullscreen mode Exit fullscreen mode

Two small details that trip people up:

  • Keep <w:anchorlock/> inside <v:roundrect>. Without it, Word lets recipients click and resize the button box instead of following the link.
  • VML arcsize is a percentage of button height, not pixels: Math.min(50, Math.max(0, Math.round((radius / height) * 100))). An 8px radius on a 46px button is 17%; a full pill caps at 50%.

To catch regressions in CI, tokenize <!--[if mso]>, <![endif]-->, <!--[if !mso]><!-->, <!--<![endif]-->, and <v:roundrect> in order. Fail the build if any <v:roundrect> appears when msoDepth <= 0, or if an <a tag follows </v:roundrect><![endif]--> without <!--[if !mso]><!-->.

2. Gmail's 102 KB Clipping Fix (Stop Crushing Your Hero Images)

When Gmail clips a campaign, most teams open TinyPNG, squash their hero JPEG from 320 KB down to 55 KB, send a test, and watch Gmail clip it in the exact same spot.

Gmail clips at 102 KB (104,448 UTF-8 bytes) of raw HTML MIME. External images fetched over HTTPS do not count against that limit.

What actually pushes a template past 104,448 bytes is markup bloat. Raw Figma-to-HTML exports often nest a single heading inside five wrapper tables and repeat 600 bytes of inline style resets on every <td>. Unpurged Tailwind or framework <style> blocks burn another 15 to 30 KB in <head> before any copy loads. Worse, inlining data:image/... base64 images adds a ~33% text tax to your HTML AND Gmail strips data: URIs on <img> anyway, leaving you with a clipped message and a broken image box.

Keep your local HTML under 92 KB (94,208 UTF-8 bytes). At send time, your ESP wraps every link in a long click-tracking redirect, adds open pixels, and appends MIME headers. That easily eats another 6 to 10 KB.

3. The 4 ESP Packaging Traps (Zero Universal ZIP)

Even lean HTML bounces on upload when packaged for the wrong ESP:

ESP Package Format Limit Required Unsubscribe Tag Classic Gotcha
Mailchimp Single flat-root .zip (no images/ folder) < 1 MB `* UNSUB
Klaviyo Twin-file: {% raw %}template.html + separate images.zip < 10 MB/img {% unsubscribe %} Single combined ZIP fails; images.zip paths are case-sensitive (images/hero.png)
Braze Single flat-root .zip (no subdirectories) < 5 MB {{${set_user_to_unsubscribed_url}}} Zipping the parent folder buries index.html one level deep
HubSpot Standalone HTML + external HTTPS CDN (no ZIP) CDN hosted {{ unsubscribe_link }} + {{ site_settings.company_name }} Relative <img src> or <v:fill src> breaks; every URL must be https://

Watch out for OS zip quirks too: macOS Finder's Compress injects __MACOSX/ and .DS_Store junk into flat-root ZIPs, and older Windows tools write \ backslashes instead of POSIX / paths.

4. When to Skip VML (And 3 Free Browser-Local Tools)

You do not always need VML or raw HTML imports. If 95% of your subscribers are on consumer Gmail or Apple Mail and square corners in Classic Outlook are fine, use a padded <td> link and save ~400 bytes per button. And if non-technical marketers edit copy every week, build native blocks inside Klaviyo or Mailchimp instead of importing HTML.

If you do ship Figma-to-HTML or custom ESP templates and want to test your own email HTML locally without uploading client templates to a random server, these three free zero-login tools run completely client-side:

Candid note: MailPack HTML (our local Figma plugin built on this engine) is queued behind AdPack HTML5 in Figma Community review, so there is zero charge today, and early access is open on the site if you want a heads-up when it ships.

Top comments (0)