# Template linter for Adobe Marketo Engage emails (`examsens.ai/email-template-linter`) Actor

Catch template mistakes before marketers build emails in Adobe Marketo Engage. It checks the template against Adobe's Email Template Syntax rules, such as an id used twice or a variable with a bad default, and flags code and images that go wrong in dark mode.

- **URL**: https://apify.com/examsens.ai/email-template-linter.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 template checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Template linter for Adobe Marketo Engage emails

Paste the HTML of an Adobe Marketo Engage email template and the actor checks it two ways. First it reads the template's code against the rules on Adobe's Email Template Syntax page: every editable area needs its own id, and every variable the template uses has to be declared in the head. Then it looks for the code and images that go wrong when a reader opens the email in dark mode. Apps such as the Gmail app on iOS and new Outlook darken the table cells your layout is built from but leave each image exactly as you saved it, so a logo saved on solid white shows up as a white box on a dark panel. Classic Outlook can turn a button's white label near black. Each problem comes back as a sentence that names the element and, where the actor can name one, the fix to make.

This actor is not affiliated with, authorized, endorsed or sponsored by Adobe, publisher of Adobe Marketo Engage. Adobe and Marketo are either registered trademarks or trademarks of Adobe in the United States and/or other countries.

### Use it for

You've finished a new template, and next week marketers start building emails from it. Paste the HTML in first and fix what it finds, such as a duplicate id, a variable the code uses but never declares, or a module sitting outside its container. I'd clear every one before anyone builds an email on the template.

When you change every template in a library at once, say to swap a brand color, give the actor the whole list and read the issue count for each template, so you open only the ones that need work.

Before you send dark mode samples to your phone and to Outlook, run the dark mode checks to catch what shows in the code. A template with no `color-scheme` tag, or one set to `light` without the word `only`, doesn't stop the Gmail app on iOS from recoloring the whole email. A classic Outlook button with no gradient fill rule has its white label turned near black. An Outlook dark mode rule whose color code doesn't match the cell it was written for leaves the text on that panel in its light mode color. Then send the samples anyway, since the actor never opens the email in a mail app.

### Sample

Input, a short template:

```html
<html><head>
<meta class="mktoString" id="textHeader" default="Edit Me">
<meta class="mktoColor" id="textColor" mktoName="Text Color" default="#fff">
<meta name="color-scheme" content="light">
</head><body>
<h1 style="color:${textColor}">${textHeader} ${subTitle}</h1>
<div class="mktoText" id="intro" mktoName="Intro">Hello</div>
<div class="mktoText" id="intro" mktoName="Closing">Bye</div>
</body></html>
```

The run returned one row with 5 issues, shown here in full:

```json
[
  { "check": "ids", "message": "The id \"intro\" is used on 2 elements (mktoText, mktoText). Each id must be unique.",
    "fix": "Give each element its own id." },
  { "check": "variables", "message": "The variable textHeader has no mktoName.",
    "where": "<meta class=mktoString id=textHeader>", "fix": "Add a descriptive mktoName." },
  { "check": "variables", "message": "The default \"#fff\" of the color variable textColor is not a 6 digit hex code such as #ffffff.",
    "where": "<meta class=mktoColor id=textColor>", "fix": "Write the default as # and six hex digits." },
  { "check": "references", "message": "${subTitle} is used 1 time(s), but no meta tag in the head declares a variable with that id.",
    "fix": "Declare it with a meta tag or fix the name." },
  { "check": "colorScheme", "message": "color-scheme is set to light without the word only. Light on its own doesn't stop the Gmail app on iOS from recoloring the email in dark mode.",
    "fix": "Change the value to \"light only\"." }
]
```

A second run, with image checks turned off, used a template built from the examples on Adobe's page. It returned no issues. That template has 4 editable regions, 2 modules in one container and 7 variables.

### Template checks

The checks below follow Adobe's Email Template Syntax page. The one exception is the check for a variable that's declared and never used: that rule is the actor's own.

- Every `mktoText`, `mktEditable`, `mktoImg`, `mktoSnippet`, `mktoVideo`, `mktoModule` and `mktoContainer` element needs an id made of letters, numbers, `-` and `_`, with no spaces. The actor flags a missing id, a bad character and an id used twice.
- Editable regions, modules and variables need a `mktoName`, the display name marketers see for them in the email editor. A `mktEditable` area with no `mktoName` is flagged too, because the editor then shows its id as the name.
- Adobe Marketo Engage class values are case sensitive, so `mktomodule` isn't read as `mktoModule`. A value with the wrong capitals is flagged with the spelling to use.
- A variable is a `meta` tag in the head with a type class (`mktoString`, `mktoList`, `mktoNumber`, `mktoColor`, `mktoBoolean`, `mktoHTML` or `mktoImg`), an `id` and a `mktoName`. A list needs at least one value, and its default has to be one of them. A number needs a numeric default inside its `min` and `max`. A color default must be a 6 digit hex code, and a boolean default must be true or false. The attributes that take true or false (`mktoModuleScope`, `allowHTML`, `mktoActive`, `mktoAddByDefault`, `mktoLockImgSize`, `mktoLockImgStyle`) are checked too.
- Each `${name}` in the template is a variable reference, and the actor flags one that no variable in the head declares. It also lists each variable the head declares and the template never uses. Add names you leave undeclared on purpose to the ignore list.
- A module is a `tr` inside a `table`, `tbody`, `thead` or `tfoot` container, or a `table` inside a `td` container. The actor flags a module outside every container, a container holding anything that isn't a module (Adobe treats that container as invalid), and a template with more than one container.

### Dark mode checks

- The `color-scheme` meta tag in the head tells mail apps which color scheme the email was designed for. A template without one is flagged. So is one set to `light` without the word `only`, because `light` on its own doesn't stop the Gmail app on iOS from recoloring the email in dark mode.
- Classic Outlook draws each button from a second copy written in VML, a drawing language Word reads (you'll see tags starting with `v:` in the button code). In dark mode, classic Outlook reverses how light or dark that copy's label is and keeps the button's fill as you set it, so a white label on a navy button turns near black. The actor lists each VML button with its fill, its label color and the contrast between the two as built. It flags every one of them when the template has no `mso-style-textfill-type:gradient` rule anywhere, the gradient fill that keeps a white label white in classic Outlook in Office 365 and Outlook 2021. If your readers use Outlook 2016 or 2019, send a sample there before you count on that fix.
- In dark mode, Outlook adds a marker named `data-ogsc` to the email, so a style rule in your head that starts with `[data-ogsc]` only takes effect then. Templates use these rules to set the text colors Outlook shows in dark mode. The actor finds each one that sets a text color and works out which elements it reaches. A rule that picks cells by their `bgcolor` color code reaches nothing when the code is written differently in the rule and on the cell, such as the three digit short form `#306` in the rule and `#330066` on the cell, and then the text on that panel never changes color. The actor flags that, and a rule naming a `bgcolor` no cell in the template has. It also flags a rule that turns text nearly the same color as the background the template gives that text, at a contrast ratio under 3:1. One example is a rule meant for a navy panel that also turns the text on a white card inside the panel white.
- The actor downloads each image the template links to. The Gmail app on iOS and new Outlook leave an image as saved when they darken the cell around it, so an edge of solid color keeps that color on a darker cell. An image with no transparent pixels and an edge of one solid color is flagged, with the advice to save it on a transparent background. Photographs, whose edges vary in color, aren't flagged.

### Input

- Template HTML, a list of templates (each with a name, the HTML and an optional base URL), or addresses that return the HTML. At least one.
- Checks to run: template syntax, dark mode, or both (default both)
- Variable names to ignore
- Base URL for relative images, check images (default on), maximum images (default 40), largest image (default 5 MB), timeout (default 20 seconds)

### Output

One dataset row per template with `name`, `ok`, `template` (counts of regions, modules, containers and the variables found), `colorScheme`, `vmlButtons`, `darkModeRules`, `images`, `issues`, `issueCount` and `issuesByCheck`. Each issue has the `check` it came from and a `message`. It also has a `fix` where the actor can name one, and a `where` that names the element when the issue belongs to one. A template that can't be read gets `ok: false` and an `error`.

### Pricing

Pay per event: one event for each template checked. A template that can't be read is not charged. The run stops when it reaches the maximum charge you set.

### Scope and conduct

The actor reads the HTML you give it and downloads the public images it links to. It doesn't log in to Adobe Marketo Engage, render the email in a mail app, send mail or collect personal data. It uses no proxies. Check templates and images you're allowed to check.

### Related actors

Other actors from the same account:

- [Domain DNS and Email Check: SPF, DMARC, DKIM, MX and SSL](https://apify.com/examsens.ai/domain-dns-check)
- [Color Palette Extractor: web pages and images to hex palettes](https://apify.com/examsens.ai/color-palette-extractor)

### Support

Questions and problems: the Issues tab on this page.

# Actor input Schema

## `html` (type: `string`):

The HTML source of one email template, as exported from your email tool.

## `templates` (type: `array`):

Several templates in one run, as a list of objects with a name and the html. An optional baseUrl resolves relative image addresses.

## `urls` (type: `array`):

Public addresses that return the template's HTML. Each page is read once.

## `checks` (type: `array`):

template checks the Email Template Syntax rules. darkMode checks the color-scheme tag, VML buttons, dark mode rules and images.

## `ignoreVariables` (type: `array`):

Names that ${...} references may use without a meta tag declaring them.

## `baseUrl` (type: `string`):

Used to resolve image sources such as /images/logo.png. Leave empty when every image address is complete.

## `checkImages` (type: `boolean`):

Download each image and look for solid edges and missing transparency (dark mode check).

## `maxImages` (type: `integer`):

Images beyond this number are left out of the check.

## `maxImageMegabytes` (type: `integer`):

A larger image is listed and not analyzed.

## `timeoutSecs` (type: `integer`):

A request that gets no answer in this time is reported as an error.

## Actor input object example

```json
{
  "html": "<html><head><meta class=\"mktoString\" id=\"textHeader\" default=\"Edit Me\"><meta class=\"mktoColor\" id=\"textColor\" mktoName=\"Text Color\" default=\"#fff\"><meta name=\"color-scheme\" content=\"light\"></head><body><h1 style=\"color:${textColor}\">${textHeader} ${subTitle}</h1><div class=\"mktoText\" id=\"intro\" mktoName=\"Intro\">Hello</div><div class=\"mktoText\" id=\"intro\" mktoName=\"Closing\">Bye</div></body></html>",
  "checks": [
    "template",
    "darkMode"
  ],
  "checkImages": true,
  "maxImages": 40,
  "maxImageMegabytes": 5,
  "timeoutSecs": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "html": "<html><head><meta class=\"mktoString\" id=\"textHeader\" default=\"Edit Me\"><meta class=\"mktoColor\" id=\"textColor\" mktoName=\"Text Color\" default=\"#fff\"><meta name=\"color-scheme\" content=\"light\"></head><body><h1 style=\"color:${textColor}\">${textHeader} ${subTitle}</h1><div class=\"mktoText\" id=\"intro\" mktoName=\"Intro\">Hello</div><div class=\"mktoText\" id=\"intro\" mktoName=\"Closing\">Bye</div></body></html>"
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/email-template-linter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "html": "<html><head><meta class=\"mktoString\" id=\"textHeader\" default=\"Edit Me\"><meta class=\"mktoColor\" id=\"textColor\" mktoName=\"Text Color\" default=\"#fff\"><meta name=\"color-scheme\" content=\"light\"></head><body><h1 style=\"color:${textColor}\">${textHeader} ${subTitle}</h1><div class=\"mktoText\" id=\"intro\" mktoName=\"Intro\">Hello</div><div class=\"mktoText\" id=\"intro\" mktoName=\"Closing\">Bye</div></body></html>" }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/email-template-linter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "html": "<html><head><meta class=\\"mktoString\\" id=\\"textHeader\\" default=\\"Edit Me\\"><meta class=\\"mktoColor\\" id=\\"textColor\\" mktoName=\\"Text Color\\" default=\\"#fff\\"><meta name=\\"color-scheme\\" content=\\"light\\"></head><body><h1 style=\\"color:${textColor}\\">${textHeader} ${subTitle}</h1><div class=\\"mktoText\\" id=\\"intro\\" mktoName=\\"Intro\\">Hello</div><div class=\\"mktoText\\" id=\\"intro\\" mktoName=\\"Closing\\">Bye</div></body></html>"
}' |
apify call examsens.ai/email-template-linter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/email-template-linter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uuVPoBdKxFg4EXkyZ/builds/5tHaclKy6La4FGlVK/openapi.json
