All Projects → posthtml → posthtml-mso

posthtml / posthtml-mso

Licence: MIT license
Makes writing Outlook conditionals in HTML emails easy.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to posthtml-mso

Stormkitty
🔑 Open source stealer written on C#, all logs will be sent to Telegram bot.
Stars: ✭ 198 (+1064.71%)
Mutual labels:  outlook
Office365FiddlerExtension
This Fiddler Extension is an Office 365 centric parser to efficiently troubleshoot Office 365 client application connectivity and functionality.
Stars: ✭ 23 (+35.29%)
Mutual labels:  outlook
emitty
A platform for finding dependencies between files and building tools for incremental compilation or build.
Stars: ✭ 69 (+305.88%)
Mutual labels:  posthtml
Spamscope
Fast Advanced Spam Analysis Tool
Stars: ✭ 223 (+1211.76%)
Mutual labels:  outlook
gromox
Groupware server backend for the grommunio Distribution, supporting MAPI/HTTP, RPC/HTTP, IMAP, POP3 protocols, PHP-MAPI bindings, and import from PST/OST/MSG/TNEF, EML/ICAL/VCF, KDB
Stars: ✭ 163 (+858.82%)
Mutual labels:  outlook
posthtml-css-modules
Use CSS modules in HTML
Stars: ✭ 54 (+217.65%)
Mutual labels:  posthtml
Org Msg
OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
Stars: ✭ 153 (+800%)
Mutual labels:  outlook
EmojiAddIn
Emoji for Outlook and Thunderbird
Stars: ✭ 21 (+23.53%)
Mutual labels:  outlook
FritzBoxTelefon-dingsbums
Das Fritz!Box Telefon-dingsbums ist ein Outlook-Addin, welches ein direktes Wählen der Kontakte aus Outlook ermöglicht. Zusätzlich bietet es nützliche Funktionen, wie einen Anrufmonitor oder eine Rückwärtssuche.
Stars: ✭ 16 (-5.88%)
Mutual labels:  outlook
alter.email
Transform your HTML emails.
Stars: ✭ 66 (+288.24%)
Mutual labels:  html-email
Mail Parser
Tokenizer for raw mails
Stars: ✭ 240 (+1311.76%)
Mutual labels:  outlook
Davmail
DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
Stars: ✭ 250 (+1370.59%)
Mutual labels:  outlook
Outlook-Add-in-SSO
[MOVED] The sample implements an Outlook add-in that uses Office's SSO system to get access to Microsoft Graph APIs and adds buttons to the Outlook ribbon.
Stars: ✭ 48 (+182.35%)
Mutual labels:  outlook
Outlook
Python library to read email from live, hotmail, outlook, office365 or any microsoft email service
Stars: ✭ 203 (+1094.12%)
Mutual labels:  outlook
responsive-html-email-templates
Collection of Free responsive HTML templates for Startups
Stars: ✭ 187 (+1000%)
Mutual labels:  html-email
Freelook
Freelook, an Electron-based client for Microsoft Outlook.
Stars: ✭ 159 (+835.29%)
Mutual labels:  outlook
BBob
⚡️Blazing-fast js-bbcode-parser, bbcode js, that transforms and parses to AST with plugin support in pure javascript, no dependencies
Stars: ✭ 133 (+682.35%)
Mutual labels:  posthtml
OutlookPasswordRecovery
This tool usable for recover Outlook passwords and it working with all versions. I tested with 2007, 2010, 2013 and 2016.
Stars: ✭ 14 (-17.65%)
Mutual labels:  outlook
LInkedIn-Reverese-Lookup
🔎Search LinkedIn profile by email address📧
Stars: ✭ 20 (+17.65%)
Mutual labels:  outlook
OotD
Outlook on the Desktop (OotD)
Stars: ✭ 76 (+347.06%)
Mutual labels:  outlook

Outlook Conditionals

Makes it easy to write Outlook conditionals in HTML emails

Version License Build Downloads

Introduction

Writing Outlook conditionals in HTML emails is gross:

<!--[if mso]>
  <div>Show this in all Outlook versions</div>
<![endif]-->

It gets even worse when you need to target specific versions:

<!--[if (gt mso 11)&(lte mso 15)]>
  <div>Show in 2007, 2010, 2013</div>
<![endif]-->

This PostHTML plugin simplifies the way you write Outlook conditional comments:

<outlook>
  <div>Show this in all Outlook versions</div>
</outlook>

Like, really simple:

<outlook gt="2003" lte="2013">
  <div>Show in 2007, 2010, 2013</div>
</outlook>

Install

$ npm i posthtml-mso

Usage

import posthtml from 'posthtml'
import mso from 'posthtml-mso'

const options = { /* see options below */ }

posthtml([mso(options)])
  .process('<outlook only="2013">Show in Outlook 2013</outlook>')
  .then(result => console.log(result.html))

Result:

<!--[if mso 15]>Show in Outlook 2013<![endif]-->

Syntax

The plugin provides two (customizable) tags:

  1. <outlook>
  2. <not-outlook>

<outlook>

This will output the content inside it, wrapped in an Outlook conditional comment.

The conditional is created based on the Outlook version(s) you need to target, which you can define inside special attributes (documented below).

Using the tag with no attributes will target all Outlook versions:

<outlook>
  <div>Show this in all Outlook versions</div>
</outlook>

Result:

<!--[if mso]>
  <div>Show this in all Outlook versions</div>
<![endif]-->

<not-outlook>

This tag will basically hide content from all Outlook versions:

<not-outlook>
  <div>All Outlooks will ignore this</div>
</not-outlook>

Result:

<!--[if !mso]><!-->
  <div>All Outlooks will ignore this</div>
<!--<![endif]-->

Attributes

To define which Outlook versions you are targeting, you can use one of the following attributes:

  • only - show only in these Outlook versions
  • not - show in all versions except these
  • lt - all versions before this (not including it, i.e. lower than)
  • lte - all versions before this (including it, i.e. lower than or equal to)
  • gt - all versions after this (not including it, i.e. greater than)
  • gte - all versions after this (including it, i.e. greater than or equal to)

only

Show the content only in this Outlook version:

<outlook only="2013">
  <div>Show only in Outlook 2013</div>
</outlook>

Result:

<!--[if mso 15]>
  <div>Show only in Outlook 2013</div>
<![endif]-->

It also supports multiple, comma-separated versions:

<outlook only="2013,2016">
  <div>Show only in Outlook 2013 and 2016</div>
</outlook>

Result:

<!--[if (mso 15)|(mso 16)]>
  <div>Show only in Outlook 2013 and 2016</div>
<![endif]-->

Note: targeting Outlook 2016 will also target Outlook 2019 (see gotchas).

not

Show content in all Outlook versions except the ones specified.

<outlook not="2013">
  <div>Don't show in Outlook 2013</div>
</outlook>

Result:

<!--[if !mso 15]>
  <div>Don't show in Outlook 2013</div>
<![endif]-->

You can also specify a comma-separated list of versions:

<outlook not="2013,2016">
  <div>Don't show in Outlook 2013 and 2016</div>
</outlook>

Result:

<!--[if !((mso 15)|(mso 16))]>
  <div>Don't show in Outlook 2013 and 2016</div>
<![endif]-->

lt

Show in all versions before this one, excluding it:

<outlook lt="2007">
  <div>Show in all Outlooks before 2007, excluding it</div>
</outlook>

Result:

<!--[if lt mso 12]>
  <div>Show in all Outlooks before 2007, excluding it</div>
<![endif]-->

lte

Show in all versions before this one, including it:

<outlook lte="2007">
  <div>Show in all Outlooks before 2007, including it</div>
</outlook>

Result:

<!--[if lte mso 12]>
  <div>Show in all Outlooks before 2007, including it</div>
<![endif]-->

gt

Show in all Outlook versions after this one, excluding it:

<outlook gt="2007">
  <div>Show in Outlook 2010, 2013, 2016, 2019</div>
</outlook>

Result:

<!--[if gt mso 12]>
  <div>Show in Outlook 2010, 2013, 2016, 2019</div>
<![endif]-->

gte

Show in all Outlook versions after this one, excluding it:

<outlook gte="2007">
  <div>Show in Outlook 2007, 2010, 2013, 2016, 2019</div>
</outlook>

Result:

<!--[if gte mso 12]>
  <div>Show in Outlook 2007, 2010, 2013, 2016, 2019</div>
<![endif]-->

Combining Attributes

You can combine the lt, gt, lte, and gte attributes if you need to target multiple versions with higher accuracy.

<outlook gt="2003" lte="2013">
  <div>Show in 2007, 2010, 2013</div>
</outlook>

Result:

<!--[if (gt mso 11)&(lte mso 15)]>
  <div>Show in 2007, 2010, 2013</div>
<![endif]-->

Gotchas

There are some cases that might not work as you'd expect.

Outlook 2019

Outlook 2019 uses the same version identifier as Outlook 2016 - 16.

Because of this, if you target either of them you will be targeting them both. Currently there is no way around this.

Duplicate Attributes

Consider this example:

<outlook gt="2003" lte="2013" gt="2007">
  <div>Show in 2007, 2010, 2013</div>
</outlook>

Since duplicate attributes are discarded when parsing, gt="2007" will not be taken into consideration.

The result will be:

<!--[if (gt mso 11)&(lte mso 15)]>
  <div>Show in 2007, 2010, 2013</div>
<![endif]-->

Unknown Versions

Made a typo like this?

<outlook lt="20007">
  <div>Target Outlooks before 2007</div>
</outlook>

If an unknown Outlook version is specified, the plugin will skip the tag and return its contents:

<div>Target Outlooks before 2007</div>

Hopefully, we won't need this plugin by then...

Options

tag

Type: string
Default: outlook

The name of the tag you want the plugin to use. Will be used for both available tags.

For example:

import posthtml from 'posthtml'
import mso from 'posthtml-mso'

const html = `
  <mso only="2013">Show in Outlook 2013</mso>
  <not-mso>Hide from Outlook</not-mso>
`

posthtml([mso({ tag: 'mso' })])
  .process(html)
  .then(result => console.log(result.html))

Result:

<!--[if mso 15]>Show in Outlook 2013<![endif]-->
<!--[if !mso]><!-->Hide from Outlook<!--<![endif]-->
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].