Skip to content

Instantly share code, notes, and snippets.

@twalker
Last active August 29, 2015 14:13
Show Gist options
  • Save twalker/f7b38a16d5e0326d9df5 to your computer and use it in GitHub Desktop.
Save twalker/f7b38a16d5e0326d9df5 to your computer and use it in GitHub Desktop.
A hack to toggle the visibility of different email content in different email clients.

Kuato's hack

The purpose of Kuato's hack is to show either :~) email content, or :~( email content, depending on the email client. MS Outlook 2007, 2010, 2013, and Outlook.com are targeted to see the :~( content. All other email clients see the :~) content.

The following email client quirks are strategically composed:

  • MS Outlook 2007, 2010, 2013 parse and adhere to mso conditional comments.
  • Outlook.com strips out mso conditional comments.
  • Modern email clients (including gmail) strip out script tags.
  • Browsers render, but do not display the contents of unknown script types.

The complete hack

<!--[if !mso]><!-->
:~)
<script type="text/plain">
  <!--<![endif]-->
  :~(
  <!--[if !mso]><!-->
</script>
<!--<![endif]-->

** The interpretation from various rendering contexts **

Outlook 2007, 2010, 2013

<!--[if !mso]>**IGNORE**<![endif]-->
  :~(
  <!--[if !mso]>**IGNORE**<![endif]-->

Outlook.com

**STRIPPED**
  :~(
**STRIPPED**

Modern email clients

<!-- html comment-->
:~)
**STRIPPED**
<!--html comment-->

Modern Browser

<!-- html comment-->
:~)
<script type="text/plain">
**IGNORE**
</script>
<!-- html comment-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment