# Html Email Debugger (`rocketagro/html-email-debugger`) Actor

Test and debug HTML emails across different email clients and devices.
Ensure your email campaigns render perfectly everywhere before hitting send. This Actor helps developers, designers, and marketers identify rendering issues, broken links, and missing assets in their email templates.

- **URL**: https://apify.com/rocketagro/html-email-debugger.md
- **Developed by:** [Jahid Hasan](https://apify.com/rocketagro) (community)
- **Categories:** E-commerce, Lead generation, SEO tools
- **Stats:** 10 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## HTML Email Debugger

**Test and debug HTML emails across different email clients and devices.**\
Ensure your email campaigns render perfectly everywhere before hitting send. The **HTML Email Debugger** Actor helps developers, designers, and marketers identify rendering issues, broken links, and missing assets in their email templates.

***

### 🚀 Features

- **Multi-Client Testing**: Simulate email rendering in Gmail, Outlook, and Apple Mail.
- **Device Compatibility**: Test across desktop and mobile screen resolutions.
- **Rendering Issue Detection**: Identify broken layouts, missing images, and CSS issues.
- **Screenshots**: Capture screenshots of email renderings for visual debugging.
- **Detailed Reports**: Export structured debugging reports with metadata, rendering issues, and screenshot URLs.
- **Automation Ready**: Integrate with your marketing workflows using the Apify platform.

***

### 📥 Input Parameters

The **HTML Email Debugger** accepts the following input parameters:

| Parameter       | Type     | Description                                                   | Required | Default Value                       |
| --------------- | -------- | ------------------------------------------------------------- | -------- | ----------------------------------- |
| `htmlContent`   | `string` | Raw HTML of the email you want to test.                       | ✅       | *None*                              |
| `subjectLine`   | `string` | Subject line to include in the test report (optional).        | ❌       | *Empty string*                      |
| `sender`        | `string` | Sender address to display in the report (optional).           | ❌       | *Empty string*                      |
| `targetClients` | `array`  | Email clients to simulate (e.g., Gmail, Outlook, Apple Mail). | ❌       | `["Gmail", "Outlook", "AppleMail"]` |
| `devices`       | `array`  | Device types to simulate (e.g., desktop, mobile).             | ❌       | `["desktop"]`                       |

#### Example Input

```json
{
  "htmlContent": "<!DOCTYPE html><html><body><h1>Welcome!</h1></body></html>",
  "subjectLine": "Welcome Email",
  "sender": "no-reply@example.com",
  "targetClients": ["Gmail", "Outlook"],
  "devices": ["desktop", "mobile"]
}
```

***

### 📤 Output

The Actor generates a detailed report containing the following:

#### Metadata:

- **subjectLine**: The subject line of the email.
- **sender**: The sender address.
- **testedAt**: The timestamp when the test was performed.

#### Screenshots:

- **client**: The email client used for rendering (e.g., Gmail, Outlook).
- **device**: The device type (e.g., desktop, mobile).
- **url**: The URL of the screenshot saved in the Apify Key-Value Store.
- **issues**: Rendering issues detected, including:
  - **brokenLinks**: List of links that returned HTTP errors.
  - **missingAssets**: List of assets (e.g., images) that failed to load.

#### Example Output

```json
{
  "meta": {
    "subjectLine": "Welcome Email",
    "sender": "no-reply@example.com",
    "testedAt": "2023-10-01T12:00:00Z"
  },
  "screenshots": [
    {
      "client": "Gmail",
      "device": "desktop",
      "url": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/Gmail_desktop.png",
      "issues": {
        "brokenLinks": ["https://example.com/broken-link"],
        "missingAssets": ["https://example.com/missing-image.png"]
      }
    }
  ]
}
```

***

### 🛠️ How It Works

1. **Input Your Email**: Provide the HTML content, subject line, sender details, and target clients/devices.
2. **Run the Actor**: The Actor renders the email in the specified clients and devices.
3. **Debugging**: The Actor captures screenshots, detects rendering issues, and generates a detailed report.
4. **Export Results**: Access the report and screenshots via the Apify platform.

***

### 🌟 Use Cases

- **Email Campaign QA**: Ensure your email campaigns render correctly across all major clients.
- **Debugging Layout Issues**: Identify broken layouts, missing images, or CSS problems.
- **Automated Testing**: Integrate with CI/CD pipelines for automated pre-send email testing.
- **Support Teams**: Empower developers, designers, and marketers with structured email QA.

***

### 📘 API Integration

The HTML Email Debugger API provides structured feedback on email rendering issues. You can integrate it with your workflows using JavaScript, Node.js, Python, or curl.

#### Example API Call (curl)

```bash
curl -X POST "https://api.apify.com/v2/acts/USERNAME~html-email-debugger/run-sync" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
  "htmlContent": "<!DOCTYPE html><html><body><h1>Welcome!</h1></body></html>",
  "targetClients": ["Gmail", "Outlook"],
  "devices": ["desktop"]
}'
```

***

### 📦 Deployment

This Actor is built using the Apify SDK and Playwright. It runs in a Docker container based on the `apify/actor-node-playwright-chrome` image.

#### Development

1. Clone the repository.
2. Install dependencies: `npm install`.
3. Run locally: `apify run`.

#### Deployment to Apify

1. Push the Actor to Apify: `apify push`.
2. Configure input parameters in the Apify console.
3. Run the Actor and review the results.

***

### 🔗 Related Links

- [Apify SDK Documentation](https://sdk.apify.com/)
- [Playwright Documentation](https://playwright.dev/)
- [Apify Actor Documentation](https://docs.apify.com/actors)

***

### 🛠 Plans & Availability

- **Flat $5/Month Coffee Bill** → Run ad-hoc validations, view JSON/CSV reports.
  Available exclusively on [Apify Marketplace](https://apify.com/).

***

### 📞 Support

Need help or a custom feature?
📧 Contact us at [support@mcp-validator.com](mailto://support@mcp-validator.com) (or via Apify support).

# Actor input Schema

## `htmlContent` (type: `string`):

Raw HTML of the email you want to test across different clients.

## `subjectLine` (type: `string`):

Subject line to include in the test report (optional).

## `sender` (type: `string`):

Optional email sender to display in reports (optional).

## `targetClients` (type: `array`):

Select which email clients to simulate (Gmail, Outlook, Apple Mail).

## `devices` (type: `array`):

Choose which device screen sizes to simulate.

## Actor input object example

```json
{
  "htmlContent": "<!DOCTYPE html><html><body style='margin:0;padding:0;'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' style='background:#f4f4f4;padding:20px;'><table width='600' cellpadding='0' cellspacing='0' border='0' style='background:white;'><tr><td align='center'><img src='https://via.placeholder.com/600x200?text=Promo+Banner' alt='Promo Banner' width='600' height='200'></td></tr><tr><td style='padding:20px;text-align:center;'><h2 style='margin-bottom:10px;'>Limited Time Offer!</h2><p style='margin:0 0 20px;'>Get 50% off all subscriptions. Hurry, offer ends soon.</p><a href='https://example.com/deal' style='display:inline-block;padding:12px 24px;background:#28a745;color:white;text-decoration:none;border-radius:5px;'>Claim Offer</a></td></tr></table></td></tr></table></body></html>",
  "subjectLine": "Your 50% OFF Coupon 🎉",
  "sender": "no-reply@example.com",
  "targetClients": [
    "Gmail",
    "Outlook",
    "AppleMail"
  ],
  "devices": [
    "desktop",
    "mobile"
  ]
}
```

# 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 = {
    "htmlContent": "<!DOCTYPE html><html><body style='margin:0;padding:0;'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' style='background:#f4f4f4;padding:20px;'><table width='600' cellpadding='0' cellspacing='0' border='0' style='background:white;'><tr><td align='center'><img src='https://via.placeholder.com/600x200?text=Promo+Banner' alt='Promo Banner' width='600' height='200'></td></tr><tr><td style='padding:20px;text-align:center;'><h2 style='margin-bottom:10px;'>Limited Time Offer!</h2><p style='margin:0 0 20px;'>Get 50% off all subscriptions. Hurry, offer ends soon.</p><a href='https://example.com/deal' style='display:inline-block;padding:12px 24px;background:#28a745;color:white;text-decoration:none;border-radius:5px;'>Claim Offer</a></td></tr></table></td></tr></table></body></html>",
    "subjectLine": "Your 50% OFF Coupon 🎉",
    "sender": "no-reply@example.com",
    "targetClients": [
        "Gmail",
        "Outlook",
        "AppleMail"
    ],
    "devices": [
        "desktop",
        "mobile"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rocketagro/html-email-debugger").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 = {
    "htmlContent": "<!DOCTYPE html><html><body style='margin:0;padding:0;'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' style='background:#f4f4f4;padding:20px;'><table width='600' cellpadding='0' cellspacing='0' border='0' style='background:white;'><tr><td align='center'><img src='https://via.placeholder.com/600x200?text=Promo+Banner' alt='Promo Banner' width='600' height='200'></td></tr><tr><td style='padding:20px;text-align:center;'><h2 style='margin-bottom:10px;'>Limited Time Offer!</h2><p style='margin:0 0 20px;'>Get 50% off all subscriptions. Hurry, offer ends soon.</p><a href='https://example.com/deal' style='display:inline-block;padding:12px 24px;background:#28a745;color:white;text-decoration:none;border-radius:5px;'>Claim Offer</a></td></tr></table></td></tr></table></body></html>",
    "subjectLine": "Your 50% OFF Coupon 🎉",
    "sender": "no-reply@example.com",
    "targetClients": [
        "Gmail",
        "Outlook",
        "AppleMail",
    ],
    "devices": [
        "desktop",
        "mobile",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("rocketagro/html-email-debugger").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 '{
  "htmlContent": "<!DOCTYPE html><html><body style='\''margin:0;padding:0;'\''><table width='\''100%'\'' cellpadding='\''0'\'' cellspacing='\''0'\'' border='\''0'\''><tr><td align='\''center'\'' style='\''background:#f4f4f4;padding:20px;'\''><table width='\''600'\'' cellpadding='\''0'\'' cellspacing='\''0'\'' border='\''0'\'' style='\''background:white;'\''><tr><td align='\''center'\''><img src='https://apify.com/''https://via.placeholder.com/600x200?text=Promo+Banner'\'' alt='\''Promo Banner'\'' width='\''600'\'' height='\''200'\''></td></tr><tr><td style='\''padding:20px;text-align:center;'\''><h2 style='\''margin-bottom:10px;'\''>Limited Time Offer!</h2><p style='\''margin:0 0 20px;'\''>Get 50% off all subscriptions. Hurry, offer ends soon.</p><a href='https://apify.com/''https://example.com/deal'\'' style='\''display:inline-block;padding:12px 24px;background:#28a745;color:white;text-decoration:none;border-radius:5px;'\''>Claim Offer</a></td></tr></table></td></tr></table></body></html>",
  "subjectLine": "Your 50% OFF Coupon 🎉",
  "sender": "no-reply@example.com",
  "targetClients": [
    "Gmail",
    "Outlook",
    "AppleMail"
  ],
  "devices": [
    "desktop",
    "mobile"
  ]
}' |
apify call rocketagro/html-email-debugger --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rocketagro/html-email-debugger"
        }
    }
}

```

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/O7K0CbZznv1XGVgm0/builds/qWZOoVF1eCHOprwp3/openapi.json
