# Email Domain Security Audit (SPF, DKIM, DMARC, MTA-STS) (`quietlinklab/email-domain-security-audit`) Actor

Passive email-domain audit from public DNS and HTTPS: SPF (lookup limit), DKIM common selectors, DMARC, MTA-STS, TLS-RPT, BIMI, MX, CAA and web TLS certificate expiry, with a score and fix list per domain.

- **URL**: https://apify.com/quietlinklab/email-domain-security-audit.md
- **Developed by:** [Quiet Link Lab](https://apify.com/quietlinklab) (community)
- **Categories:** Developer tools, SEO tools
- **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 auditeds

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 Domain Security Audit (SPF, DKIM, DMARC, MTA-STS, TLS)

Audit the e-mail authentication and transport-security setup of one domain or a whole list – **from public DNS and
public HTTPS only**. For every domain you get a grade (A–F), a 0–100 score, the parsed result of each check and a
prioritised list of problems with a suggested fix.

Why it matters: large mailbox providers (for example Microsoft for Outlook.com, in force since May 2025) reject or
junk mail from high-volume domains without valid SPF, DKIM and DMARC, and spoofed mail is only blocked when DMARC is enforced.

### What is checked

| Check | What the Actor does |
|---|---|
| **MX** | Lists MX hosts, flags hosts without address records and MX-to-CNAME, detects the "null MX" of domains that send no mail, hints the mail provider |
| **SPF** | Parses the record, counts the **DNS-lookup terms recursively** (limit 10), detects multiple records, broken/looping `include`, `+all` / `?all` / `~all`, `ptr`, very broad `ip4` ranges |
| **DMARC** | Policy `p`/`sp`/`pct`, report addresses, **external report authorisation**, organisational-domain fallback for sub-domains |
| **DKIM** | Looks up about 30 **common selector names** (default, google, selector1/2, s1/s2, k1–k3, …) plus your own; reports key type and **RSA key length**, testing mode, revoked keys |
| **MTA-STS** | `_mta-sts` TXT, downloads the public policy file (`https://mta-sts.<domain>/.well-known/mta-sts.txt`, no redirects), checks mode, `max_age` and whether every MX host is covered |
| **TLS-RPT** | `_smtp._tls` TXT |
| **BIMI** (optional) | `default._bimi` TXT; notes when DMARC is not enforced so the logo would not show |
| **CAA** | Walks up the DNS tree for CAA records |
| **Web TLS certificate** | One standard TLS handshake with `<domain>:443` (and `www.`) to read expiry, chain trust, name match and TLS version |

Domains with a null MX (or no MX and `v=spf1 -all`) are treated as "sends/receives no mail": DKIM, MTA-STS, TLS-RPT and BIMI are skipped and only SPF/DMARC hardening is judged. MTA-STS and TLS-RPT are also skipped when the domain has no explicit MX records.

### Output

One dataset row per domain:

| Field | Meaning |
|---|---|
| `domain`, `registeredDomain`, `status` | `audited` · `not_found` (NXDOMAIN) · `dns_error` · `invalid_input` · `audit_failed` |
| `grade`, `score`, `issueCounts` | A–F and 0–100 (heuristic), number of high/medium/low/info findings |
| `mailProfile` | `mail-enabled`, `no-mail (null MX)`, `implicit MX (A record only)`, … |
| `spfPolicy`, `dmarcPolicy`, `mtaStsMode`, `dkimSelectorsFound`, `earliestCertExpiryDays` | Flat fields for quick filtering |
| `issues[]` | `severity`, `check`, `code`, `message`, `recommendation`, `scoreImpact` |
| `mx`, `spf`, `dmarc`, `dkim`, `mtaSts`, `tlsRpt`, `bimi`, `caa`, `webTls` | Full parsed details |
| `dnsQueries` | DNS queries used for this domain |

A run summary (`OUTPUT` in the key-value store) counts domains per grade.

### Pricing

Pay per event: **$0.003 per audited domain** (plus the standard Actor start event). A domain is billed only when it
exists and DNS answered. Non-existent domains, DNS failures and invalid input are **not billed**.
`maxDomains` (default 50) is a hard cap on cost.

### Input example

```json
{
  "domains": ["example.com", "example.org"],
  "dkimSelectors": ["20260101"],
  "checkWebTls": true
}
```

### Honest limits

- **DKIM cannot be fully tested from DNS.** Selector names are arbitrary. "No DKIM found" means none of the tried
  selectors exist, **not** that DKIM is missing. Add your real selector (the `s=` tag in a `DKIM-Signature` header).
- **No SMTP.** The Actor never connects to port 25, so it cannot see whether your mail servers actually offer
  STARTTLS or which certificate they present. MTA-STS/TLS-RPT are checked only as published DNS/HTTPS data.
- **DNSSEC is not validated**, and results depend on the DNS resolver of the platform at the time of the run (DNS caches, split-horizon DNS).
- The score is a heuristic summary of the findings, **not a compliance certification**. SPF lookup counting
  follows RFC 7208 terms but cannot see mechanisms hidden behind DNS failures (flagged as incomplete).
- The TLS certificate check opens one ordinary HTTPS connection to the web host; it reports the negotiated TLS version and
  does not test cipher strength or scan other ports.

### Responsible use

- Audit your own domains or domains you are allowed to assess. Everything the Actor reads is public by design
  (DNS records, the MTA-STS policy file, a TLS certificate).
- No port scanning, no SMTP probing, no login, no exploitation, no attack traffic. About 40–60 DNS queries and
  up to three connections per domain; domains are processed 3 at a time by default.
- E-mail addresses in the input are reduced to their domain; the part before `@` is discarded and never output.
- Requests to private/loopback network addresses are refused.

# Actor input Schema

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

Domain names such as example.com (URLs and e-mail addresses are reduced to their domain; the part before the @ is discarded). Audit your own domains or domains you are allowed to assess - all checks use public DNS and public HTTPS only.

## `maxDomains` (type: `integer`):

Hard cap on audited domains = hard cap on cost (each audited domain is one billed event).

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

Your own DKIM selector names (the s= value in a DKIM-Signature header, e.g. 20260101). Added to the built-in list of common selectors.

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

Look up about 30 widely used selector names (default, google, selector1, selector2, s1, k1, ...). About 30 extra DNS queries per domain.

## `checkDkim` (type: `boolean`):

Turn the whole DKIM check off to save DNS queries.

## `checkMtaSts` (type: `boolean`):

Read the \_mta-sts TXT record and fetch the public policy file over HTTPS.

## `checkTlsRpt` (type: `boolean`):

Look up the \_smtp.\_tls TXT record.

## `checkBimi` (type: `boolean`):

Look up default.\_bimi TXT.

## `checkWebTls` (type: `boolean`):

Open one standard TLS connection to port 443 of the domain (and www.) and read the certificate expiry. Skipped when the name has no address record.

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

Domains audited in parallel.

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

Timeout for the MTA-STS policy download and the TLS handshake.

## Actor input object example

```json
{
  "domains": [
    "example.com"
  ],
  "maxDomains": 50,
  "checkCommonDkimSelectors": true,
  "checkDkim": true,
  "checkMtaSts": true,
  "checkTlsRpt": true,
  "checkBimi": true,
  "checkWebTls": true,
  "concurrency": 3,
  "timeoutSecs": 8
}
```

# Actor output Schema

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

All audited domains in the default dataset.

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

Table view with grade, score and key policies.

# 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": [
        "example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("quietlinklab/email-domain-security-audit").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": ["example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("quietlinklab/email-domain-security-audit").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": [
    "example.com"
  ]
}' |
apify call quietlinklab/email-domain-security-audit --silent --output-dataset

```

## MCP server setup

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

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/4dpYaYOR86OJbbfds/builds/MHs5aJ4lg8t5g8KMc/openapi.json
