hteumeuleu / email-bugs

Email quirks and bugs
528 stars 20 forks source link

Airmail macOS interprets code in conditional comments #138

Open hteumeuleu opened 4 months ago

hteumeuleu commented 4 months ago

The Airmail App version 5.7.2 on macOS 14.2.1 interprets code in conditional comments. Here’s a code example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Airmail Conditional Comments Bug</title>
    <!--[if mso]>
    <style type="text/css">
        table { background:red; }
    </style>
    <![endif]-->
</head>
<body>
    <table border="1" cellpadding="1" cellspacing="1">
        <tr>
            <td width="100" height="100">
                Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </td>
        </tr>
    </table>
    <!--[if mso]>
    <table border="1" cellpadding="1" cellspacing="1">
        <tr>
            <td width="100" height="100">
                Lorem ipsum dolor sit amet, consectetur adipisicing elit.
            </td>
        </tr>
    </table>
    <![endif]-->
</body>
</html>

And here's how it looks in Airmail:

Capture d’écran 2024-04-15 à 13 53 24

husseinalhammad commented 4 months ago

Does this affect all HTML comments?

hteumeuleu commented 4 months ago

No, only conditional comments. Even stuff like <!--[if foobar]> sees its content visible in Airmail.

husseinalhammad commented 4 months ago

Potentially the intent is to strip all HTML comments (and the contents inside), but they are incorrectly parsing comments. Similar to the Yahoo and GANGA bug: https://github.com/hteumeuleu/email-bugs/issues/95

I don't have access to Airmail macOS currently, but I think it's worth testing something like this:

<!--
  some comment -> is this part visible on Airmail macOS?
-->
hteumeuleu commented 4 months ago

I did test that, and the content is not visible. To me, this is very reminiscent of the T-Online bug with conditional comments. In fact, I used a template I made for that bug back then and here’s the result:

Screenshot of an email inside Airmail showing conditional comments interpreted

Here's the code:

<!-- <p>This is an HTML comment.</p> -->
<!--[if mso]>
<p>This is a mso conditional comment.</p>
<![endif]-->
<!--[if foobar]>
<p>This is a foobar conditional comment.</p>
<![endif]-->

<hr />

<!--[if !mso]><!-->
<p>This is everything but The Outlooks.</p>
<!--<![endif]-->

<!--[if true]>
<table align="center" border="1" cellpadding="1" cellspacing="1" style="width:600px;">
    <tr>
        <td>
<![endif]-->
<!--[if false]></td></tr></table><![endif]-->
<div style="max-width:600px; margin:auto;">
    This is the content.
</div>
<!--[if false]><table><tr><td><![endif]-->
<!--[if mso]>
        </td>
    </tr>
</table>
<![endif]-->