# Email Security Checker – SPF, DMARC, DKIM, MTA-STS Audit (`adamplaenitz/email-security-checker`) Actor

Bulk e-mail authentication audit per domain: MX, SPF (DNS lookup count), DMARC, DKIM keys, MTA-STS policy, TLS-RPT, BIMI and DNSSEC. Transparent 0–100 score, grade and prioritised issues with fixes. DNS-only, no personal data.

- **URL**: https://apify.com/adamplaenitz/email-security-checker.md
- **Developed by:** [Adam Plänitz](https://apify.com/adamplaenitz) (community)
- **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 domain 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

## Email Security Checker – SPF, DMARC, DKIM, MTA-STS Audit

**Audit the e-mail authentication setup of hundreds of domains in one run: MX, SPF (with the real DNS lookup count), DMARC, DKIM keys, MTA-STS policy, TLS-RPT, BIMI and DNSSEC.** Every domain gets a **0–100 score**, a **grade A–F** and a prioritised list of **issues with a concrete recommendation**. The scoring is fully documented below – no black box. Export as JSON, CSV or Excel, or connect to Google Sheets, Make, Zapier, n8n, Slack or webhooks.

### What does it check?

| Area | What you get |
|---|---|
| **MX** | MX hosts with priority, null MX (`MX 0 .`), hosts that do not resolve, detected mail provider (Google Workspace, Microsoft 365, Proofpoint, Mimecast, Proton, IONOS …) |
| **SPF** | The record, number of records (more than one = permanent error), `-all` / `~all` / `?all` / `+all`, **DNS lookups counted recursively through all includes and redirects against the limit of 10**, void lookups (limit 2), loops, includes without SPF, deprecated `ptr`, overly broad IP ranges |
| **DMARC** | Policy `p`, subdomain policy `sp`, `pct`, alignment, aggregate/failure reporting, **inherited policy from the parent domain** (DMARC tree walk), test mode, whether external report receivers have authorised the domain. **Report addresses are reduced to their domain** – mailbox names are never output |
| **DKIM** | Keys found for 38 common selectors plus your own selectors: key type, **key length** (1024 vs 2048 bit), testing flag, revoked keys, wildcard detection |
| **MTA-STS** | `_mta-sts` TXT record, **download and validation of the policy file** (mode, max_age, valid certificate, no redirects) and whether **every MX host is covered** by the policy |
| **TLS-RPT** | `_smtp._tls` record and report destination domains |
| **BIMI** | Record, logo URL, certificate (VMC) present, DMARC enforcement prerequisite |
| **DNSSEC** | Signed and validated, unsigned, or **broken (bogus)** |

### Who is it for?

- **IT and security teams** checking their domain portfolio (including parked domains) before attackers or mailbox providers do.
- **Agencies, MSPs and e-mail deliverability consultants** auditing client domains in bulk and showing what to fix first.
- **Marketing / CRM teams** preparing for the Gmail, Yahoo and Microsoft bulk-sender requirements (SPF, DKIM, DMARC).
- **Scheduled monitoring:** run weekly and get notified when a grade drops or a new critical issue appears.

### Input

| Field | Default | Description |
|---|---|---|
| Domains | – | `example.com`; URLs and e-mail addresses work too (only the domain is used, `www.` is removed). Duplicates are removed. |
| Additional DKIM selectors | – | Your providers' selectors, e.g. `s1`, `20230601`, `k2`. |
| Check common DKIM selectors | on | 38 widely used selectors. |
| Check DNSSEC | on | Via DNS-over-HTTPS (see below). |
| Download the MTA-STS policy | on | Fetches and validates the policy file. |
| Parallel domains | 10 | 1–50. |
| DNS timeout | 5 s | Per query, two tries. |

### Output example (shortened)

```json
{
  "input": "github.com",
  "domain": "github.com",
  "grade": "C",
  "score": 71,
  "topIssues": "none",
  "issueCount": 4,
  "receivesMail": true,
  "mxHosts": ["github-com.mail.protection.outlook.com"],
  "mailProvider": "Microsoft 365",
  "spfPolicy": "~all",
  "spfDnsLookups": 10,
  "dmarcPolicy": "quarantine",
  "dmarcPct": 100,
  "dmarcReports": true,
  "dkimFound": true,
  "dkimSelectors": ["selector1", "google", "k1", "k2", "k3", "s1", "s2", "cm", "smtpapi"],
  "mtaStsMode": "missing",
  "tlsRpt": false,
  "bimi": false,
  "dnssec": "unsigned",
  "issues": [
    { "severity": "medium", "area": "DKIM", "code": "dkim_1024_bit", "message": "DKIM key with only 1024 bits (selector selector1).", "recommendation": "Rotate to a 2048-bit RSA key." },
    { "severity": "low", "area": "SPF", "code": "spf_lookups_near_limit", "message": "The SPF record needs 10 of the allowed 10 DNS lookups – one more include breaks SPF.", "recommendation": "Flatten or remove includes before adding another sending service." },
    { "severity": "low", "area": "MTA-STS", "code": "mta_sts_missing", "message": "No MTA-STS policy – inbound mail can be downgraded to unencrypted transport.", "recommendation": "Publish _mta-sts TXT and a policy file at https://mta-sts.<domain>/.well-known/mta-sts.txt (start with mode: testing)." },
    { "severity": "low", "area": "DNSSEC", "code": "dnssec_unsigned", "message": "The DNS zone is not signed with DNSSEC – DNS answers (MX, SPF, DKIM) can be spoofed.", "recommendation": "Enable DNSSEC at your DNS provider and add the DS record at your registrar." }
  ],
  "issueCounts": { "critical": 0, "high": 0, "medium": 1, "low": 3, "info": 3 },
  "scoreBreakdown": { "spf": 23, "dmarc": 25, "dkim": 13, "mx": 10, "mtaSts": 0, "tlsRpt": 0, "dnssec": 0, "bimi": 0 },
  "details": {
    "spf": { "record": "v=spf1 ip4:192.30.252.0/22 include:spf.protection.outlook.com … ~all", "dnsLookups": 10, "voidLookups": 0, "includes": ["spf.protection.outlook.com", "_netblocks.google.com", "…"], "errors": [] },
    "dmarc": { "policy": "quarantine", "subdomainPolicy": "reject", "pct": 100, "aggregateReportDomains": ["github.com"], "inherited": false },
    "dkim": { "selectorsChecked": 38, "found": [{ "selector": "selector1", "keyType": "rsa", "keyBits": 1024 }] },
    "mtaSts": { "present": false },
    "dnssec": { "status": "unsigned", "resolver": "cloudflare-dns.com" }
  },
  "durationMs": 164,
  "error": null
}
```

Severities: `critical`, `high`, `medium`, `low`, `info` (info items explain points without being a problem). The **Overview** table shows domain, grade, score, critical/high issues, mail provider, SPF, SPF lookups, DMARC, DKIM selectors, MTA-STS, TLS-RPT, BIMI and DNSSEC.

### How the score works (100 points)

| Area | Max | Rules |
|---|---|---|
| SPF | 25 | 10 for exactly one syntactically valid record (3 with syntax errors) · 10 for `-all`, 8 `~all`, 2 `?all` or no `all`, 0 `+all` (−5 for very broad IP ranges in the own record) · 5 if ≤ 10 DNS lookups and ≤ 2 void lookups. Missing or multiple records: 0. |
| DMARC | 30 | 10 for a valid record · policy 15 `reject`, 10 `quarantine`, 3 `none` (scaled by `pct` below 100, minimum 3) · 5 for aggregate reports (`rua`). Inherited policies use `sp` of the parent. Missing / multiple / invalid: 0. |
| DKIM | 15 | 12 if a key is found for a checked selector · +3 if all RSA keys have ≥ 2048 bits (+1 for 1024 bits). |
| MX | 10 | 10 if all MX hosts resolve or a null MX is published · 5 if no MX record or only some hosts resolve · 0 if none resolve. |
| MTA-STS | 8 | 8 `enforce` with a valid policy covering all MX hosts · 4 `testing` · 2 `enforce` with uncovered MX hosts · 0 missing / unreachable / invalid / `none`. |
| TLS-RPT | 4 | 4 valid record · 1 invalid record. |
| DNSSEC | 5 | 5 if validated (AD flag). |
| BIMI | 3 | 3 valid record with enforced DMARC · 1 without enforcement or with errors. |

**Not applicable = full points:** for domains that do not receive mail (null MX or no MX), MTA-STS and TLS-RPT are not applicable; for domains that send no mail (`v=spf1 -all`), DKIM and BIMI are not applicable. A parked domain with null MX, `v=spf1 -all` and `p=reject` can therefore reach 100.

**Grades:** A ≥ 90 · B ≥ 75 · C ≥ 60 · D ≥ 40 · F < 40. **A critical issue (e.g. `+all`, two SPF or DMARC records, broken DNSSEC) caps the grade at C.**

### Pricing and speed

See the **Pricing** tab. You pay per checked domain; **rows for domains that cannot be checked (domain does not exist, DNS servers not answering, invalid input) are free**. Duplicates are removed before checking.

A domain needs about 20–60 DNS queries (popular SPF includes are cached within a run) and typically takes 0.2–1 second. In a cloud test with the default of 10 parallel domains, the Tranco top 1,000 domains took about 2 minutes (≈ 35 DNS queries per domain). The Actor runs with 256 MB memory. You can set a maximum cost per run – the Actor stops cleanly when it is reached.

### How it works, privacy and responsible use

- **Passive, public data only:** DNS queries through the system resolver, one HTTPS download of the public MTA-STS policy file (only if the domain announces MTA-STS) and one DNS-over-HTTPS query for DNSSEC. No e-mail is sent, no mail server is contacted, no port scanning, no login attempts.
- **DNS-over-HTTPS:** Node.js cannot read the DNSSEC "authenticated data" flag from the system resolver, so the DNSSEC status is asked from a validating public resolver (Cloudflare 1.1.1.1, fallback Google 8.8.8.8) via its JSON API. You can switch this off.
- **No personal data:** DMARC and TLS-RPT report addresses are reduced to their domain; if you enter e-mail addresses, only the domain is used and stored. No WHOIS data, no SOA contact address.
- **Please check only domains you own or are allowed to assess.** Results are technical indicators of the published DNS configuration, **not a security certification or a deliverability guarantee**.

### Limits

- **DKIM selectors cannot be enumerated.** "No DKIM key found" means none of the checked selectors exists – add your providers' selectors in the input for a definitive answer.
- The SPF lookup count follows RFC 7208 statically; mechanisms with macros (`%{i}`) are counted but not expanded.
- MTA-STS checks the policy and MX coverage, not the TLS certificates of the MX servers themselves; DANE/TLSA is not checked.
- Results reflect the DNS at the time of the run (caches may delay recent changes by the record's TTL).

Questions or feature requests? Please open an issue in the **Issues** tab.

# Actor input Schema

## `domains` (type: `array`):

One domain per line, e.g. example.com. URLs and e-mail addresses are accepted too – only the domain is used (a leading www. is removed; the part before @ is never stored). Duplicates are removed. Only check domains you own or are allowed to assess.

## `dkimSelectors` (type: `array`):

DKIM selectors cannot be listed via DNS. Add the selectors your mail services use (e.g. the part before .\_domainkey in your DNS, such as 's1' or '20230601') – they are checked for every domain in addition to the common selectors.

## `checkCommonDkimSelectors` (type: `boolean`):

Tries 38 widely used selectors (Microsoft 365, Google, Mailchimp, SendGrid, Proton, Zoho, Fastmail, HubSpot …).

## `checkDnssec` (type: `boolean`):

Asks a validating public resolver (Cloudflare 1.1.1.1, fallback Google) via DNS-over-HTTPS whether the domain's DNS answers are DNSSEC-validated. This is the only check that does not use the system resolver.

## `fetchMtaStsPolicy` (type: `boolean`):

If a domain announces MTA-STS, its policy file is downloaded from https://mta-sts.<domain>/.well-known/mta-sts.txt and checked (mode, max_age, all MX hosts covered).

## `concurrency` (type: `integer`):

How many domains are checked at the same time (1–50). Each domain needs about 20–60 DNS queries.

## `dnsTimeoutSecs` (type: `integer`):

Timeout per DNS query (each query is tried twice). The MTA-STS and DNS-over-HTTPS requests use at least 5 seconds.

## Actor input object example

```json
{
  "domains": [
    "apify.com",
    "github.com",
    "wikipedia.org",
    "example.com"
  ],
  "checkCommonDkimSelectors": true,
  "checkDnssec": true,
  "fetchMtaStsPolicy": true,
  "concurrency": 10,
  "dnsTimeoutSecs": 5
}
```

# Actor output Schema

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

One item per domain with score, grade, the key settings and a prioritised list of issues with recommendations.

## `summary` (type: `string`):

Grade distribution, errors, DNS query statistics and charged results.

# 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 = {
    "domains": [
        "apify.com",
        "github.com",
        "wikipedia.org",
        "example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("adamplaenitz/email-security-checker").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 = { "domains": [
        "apify.com",
        "github.com",
        "wikipedia.org",
        "example.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("adamplaenitz/email-security-checker").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 '{
  "domains": [
    "apify.com",
    "github.com",
    "wikipedia.org",
    "example.com"
  ]
}' |
apify call adamplaenitz/email-security-checker --silent --output-dataset

```

## MCP server setup

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

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/IydCgiyoEdEUgSDlh/builds/yOQbFJ5gmd2GDOK2x/openapi.json
