Mail authentication
Check SPF, DKIM and DMARC as a receiving mail server does, sign messages with DKIM and check that an email address and its domain can receive mail. Typical uses: check the origin of a received message, validate an address before sending.
mail spf_checkmail spf_checkmail dmarc_recordmail dmarc_recordmail dmarc_evaluatemail dmarc_evaluatemail dkim_verifymail dkim_verifymail dkim_signmail address_checkmail address_check
mail spf_check <ip> <sender>
Description
SPF check of the sending server for an envelope sender, with the system DNS
SPF check of the sending server for an envelope sender, with the system DNS
Parameters
ip: The IP address of the client that connects to the mail server (IPv4 or IPv6) - String - required
sender: The MAIL FROM address (the envelope sender), or a domain; empty for a bounce (the HELO name of params.helo is then checked) - String - required
ip: The IP address of the client that connects to the mail server (IPv4 or IPv6) - String - required
sender: The MAIL FROM address (the envelope sender), or a domain; empty for a bounce (the HELO name of params.helo is then checked) - String - required
admin
mail spf_check "192.0.2.5" "a@example.test"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "example.test", "sender": "a@example.test", "ip": "192.0.2.5", "mechanism": "ip4:192.0.2.0/24", "record": "v=spf1 ip4:192.0.2.0/24 a mx include:_spf.partner.test exists:%{i}.ok.example.test ~all", "explanation": null, "problem": null, "lookups": 0, "void_lookups": 0, "offline": false, "trace": ["example.test: v=spf1 ip4:192.0.2.0/24 a mx include:_spf.partner.test exists:%{i}.ok.example.te...", "'ip4:192.0.2.0/24' matches: pass"]}
mail spf_check <ip> <sender> <json_params>
Description
SPF check with parameters: helo (the HELO name, %{h}; it is checked when sender is empty), receiver (%{r} of explanations), now (%{t}), max_time_ms (20000, 100 to 600000: the whole check), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
SPF check with parameters: helo (the HELO name, %{h}; it is checked when sender is empty), receiver (%{r} of explanations), now (%{t}), max_time_ms (20000, 100 to 600000: the whole check), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Parameters
ip: The IP address of the client that connects to the mail server (IPv4 or IPv6) - String - required
sender: The MAIL FROM address (the envelope sender), or a domain; empty for a bounce (the HELO name of params.helo is then checked) - String - required
json_params: The parameters, as a JSON object - String - required
ip: The IP address of the client that connects to the mail server (IPv4 or IPv6) - String - required
sender: The MAIL FROM address (the envelope sender), or a domain; empty for a bounce (the HELO name of params.helo is then checked) - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail spf_check "192.0.2.10" "billing@example.com" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "example.com", "sender": "billing@example.com", "ip": "192.0.2.10", "mechanism": "ip4:192.0.2.0/24", "record": "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "explanation": null, "problem": null, "lookups": 0, "void_lookups": 0, "offline": true, "trace": ["example.com: v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "'ip4:192.0.2.0/24' matches: pass"]}
A server of the mail provider, through include: pass
admin
mail spf_check "198.51.100.7" "billing@example.com" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "example.com", "sender": "billing@example.com", "ip": "198.51.100.7", "mechanism": "include:_spf.mailer.example.net", "record": "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "explanation": null, "problem": null, "lookups": 1, "void_lookups": 0, "offline": true, "trace": ["example.com: v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "include _spf.mailer.example.net", "_spf.mailer.example.net: v=spf1 ip4:198.51.100.0/24 ~all", "'ip4:198.51.100.0/24' matches: pass", "'include:_spf.mailer.example.net' matches: pass"]}
Another server: fail
admin
mail spf_check "203.0.113.200" "billing@example.com" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "fail", "identity": "mailfrom", "domain": "example.com", "sender": "billing@example.com", "ip": "203.0.113.200", "mechanism": "-all", "record": "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "explanation": null, "problem": null, "lookups": 1, "void_lookups": 0, "offline": true, "trace": ["example.com: v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "include _spf.mailer.example.net", "_spf.mailer.example.net: v=spf1 ip4:198.51.100.0/24 ~all", "'~all' matches: softfail", "'-all' matches: fail"]}
IPv6
admin
mail spf_check "2001:db8::25" "billing@example.com" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "example.com", "sender": "billing@example.com", "ip": "2001:db8::25", "mechanism": "ip6:2001:db8::/32", "record": "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "explanation": null, "problem": null, "lookups": 0, "void_lookups": 0, "offline": true, "trace": ["example.com: v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "'ip6:2001:db8::/32' matches: pass"]}
redirect to the record of another domain
admin
mail spf_check "192.0.2.10" "news@news.example.com" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "news.example.com", "sender": "news@news.example.com", "ip": "192.0.2.10", "mechanism": "ip4:192.0.2.0/24", "record": "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "explanation": null, "problem": null, "lookups": 1, "void_lookups": 0, "offline": true, "trace": ["news.example.com: v=spf1 redirect=example.com", "redirect to example.com", "example.com: v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all", "'ip4:192.0.2.0/24' matches: pass"]}
mx and an explanation with macros
admin
mail spf_check "203.0.113.99" "jo@strict.example.org" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "fail", "identity": "mailfrom", "domain": "strict.example.org", "sender": "jo@strict.example.org", "ip": "203.0.113.99", "mechanism": "-all", "record": "v=spf1 a mx -all exp=why.example.org", "explanation": "203.0.113.99 is not a mail server of strict.example.org, see https://example.org/mail", "problem": null, "lookups": 2, "void_lookups": 0, "offline": true, "trace": ["strict.example.org: v=spf1 a mx -all exp=why.example.org", "'-all' matches: fail"]}
More than 10 DNS lookups: permerror
admin
mail spf_check "192.0.2.200" "x@loop.example.net" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "permerror", "identity": "mailfrom", "domain": "loop.example.net", "sender": "x@loop.example.net", "ip": "192.0.2.200", "mechanism": null, "record": null, "explanation": null, "problem": "more than 10 DNS lookups (RFC 7208 4.6.4)", "lookups": 11, "void_lookups": 0, "offline": true, "trace": ["loop.example.net: v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net incl...", "include a1.example.net", "a1.example.net: v=spf1 a:h1.example.net a:h2.example.net -all", "'-all' matches: fail", "include a2.example.net", "a2.example.net: v=spf1 a:h3.example.net a:h4.example.net -all", "'-all' matches: fail", "include a3.example.net", "a3.example.net: v=spf1 a:h5.example.net -all", "'-all' matches: fail", "include a4.example.net", "a4.example.net: v=spf1 -all", "'-all' matches: fail", "include a5.example.net", "a5.example.net: v=spf1 -all", "'-all' matches: fail"]}
A bounce (empty sender): the HELO name is checked
admin
mail spf_check "192.0.2.77" "" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}, \"helo\": \"mx.client.example\"}"
mentdb
{"result": "pass", "identity": "helo", "domain": "mx.client.example", "sender": "postmaster@mx.client.example", "ip": "192.0.2.77", "mechanism": "a", "record": "v=spf1 a -all", "explanation": null, "problem": null, "lookups": 1, "void_lookups": 0, "offline": true, "trace": ["mx.client.example: v=spf1 a -all", "'a' matches: pass"]}
No SPF record: none
admin
mail spf_check "192.0.2.10" "a@unknown.example" "{\"records\": {\"example.com\": {\"TXT\": [\"v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:_spf.mailer.example.net -all\", \"google-site-verification=abc\"]}, \"_spf.mailer.example.net\": {\"TXT\": [\"v=spf1 ip4:198.51.100.0/24 ~all\"]}, \"news.example.com\": {\"TXT\": [\"v=spf1 redirect=example.com\"]}, \"strict.example.org\": {\"TXT\": [\"v=spf1 a mx -all exp=why.example.org\"], \"A\": [\"203.0.113.5\"], \"MX\": [\"10 mail.example.org\"]}, \"mail.example.org\": {\"A\": [\"203.0.113.25\"]}, \"why.example.org\": {\"TXT\": [\"%{i} is not a mail server of %{d}, see https://example.org/mail\"]}, \"loop.example.net\": {\"TXT\": [\"v=spf1 include:a1.example.net include:a2.example.net include:a3.example.net include:a4.example.net include:a5.example.net include:a6.example.net -all\"]}, \"a1.example.net\": {\"TXT\": [\"v=spf1 a:h1.example.net a:h2.example.net -all\"]}, \"a2.example.net\": {\"TXT\": [\"v=spf1 a:h3.example.net a:h4.example.net -all\"]}, \"a3.example.net\": {\"TXT\": [\"v=spf1 a:h5.example.net -all\"]}, \"a4.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a5.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"a6.example.net\": {\"TXT\": [\"v=spf1 -all\"]}, \"h1.example.net\": {\"A\": [\"192.0.2.1\"]}, \"h2.example.net\": {\"A\": [\"192.0.2.2\"]}, \"h3.example.net\": {\"A\": [\"192.0.2.3\"]}, \"h4.example.net\": {\"A\": [\"192.0.2.4\"]}, \"h5.example.net\": {\"A\": [\"192.0.2.6\"]}, \"mx.client.example\": {\"TXT\": [\"v=spf1 a -all\"], \"A\": [\"192.0.2.77\"]}}}"
mentdb
{"result": "none", "identity": "mailfrom", "domain": "unknown.example", "sender": "a@unknown.example", "ip": "192.0.2.10", "mechanism": null, "record": null, "explanation": null, "problem": null, "lookups": 0, "void_lookups": 0, "offline": true, "trace": ["unknown.example: no SPF record"]}
The DNS of the domain fails: temperror
admin
mail spf_check "192.0.2.10" "a@example.com" "{\"records\": {\"example.com\": {\"SERVFAIL\": true}}}"
mentdb
{"result": "temperror", "identity": "mailfrom", "domain": "example.com", "sender": "a@example.com", "ip": "192.0.2.10", "mechanism": null, "record": null, "explanation": null, "problem": "DNS error for example.com (SERVFAIL in records)", "lookups": 0, "void_lookups": 0, "offline": true, "trace": []}
Fixed result from a real call on a local test server (127.0.0.1): a real DNS server
admin
mail spf_check "192.0.2.5" "a@example.test" "{\"dns_server\": \"127.0.0.1:26053\", \"helo\": \"mail.client.test\", \"timeout_ms\": 2000}"
mentdb
{"result": "pass", "identity": "mailfrom", "domain": "example.test", "sender": "a@example.test", "ip": "192.0.2.5", "mechanism": "ip4:192.0.2.0/24", "record": "v=spf1 ip4:192.0.2.0/24 a mx include:_spf.partner.test exists:%{i}.ok.example.test ~all", "explanation": null, "problem": null, "lookups": 0, "void_lookups": 0, "offline": false, "trace": ["example.test: v=spf1 ip4:192.0.2.0/24 a mx include:_spf.partner.test exists:%{i}.ok.example.te...", "'ip4:192.0.2.0/24' matches: pass"]}
Fixed result from a real call on a local test server (127.0.0.1): a DNS server that does not answer
admin
mail spf_check "192.0.2.5" "a@example.test" "{\"dns_server\": \"127.0.0.1:26999\", \"timeout_ms\": 500}"
mentdb
{"result": "temperror", "identity": "mailfrom", "domain": "example.test", "sender": "a@example.test", "ip": "192.0.2.5", "mechanism": null, "record": null, "explanation": null, "problem": "no answer from the DNS server for example.test (time-out or unreachable)", "lookups": 0, "void_lookups": 0, "offline": false, "trace": []}
Used in use cases (1 recipe)
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Often used with
mail dkim_sign · mail dkim_verify · mail dmarc_evaluate · secret set · string replace
mail dkim_sign · mail dkim_verify · mail dmarc_evaluate · secret set · string replace
mail dmarc_record <domain>
Description
The DMARC policy of a domain, with the system DNS. Result: {domain, org_domain, found, record_domain, record, policy (for this domain: sp for a subdomain), tags, error, problems, offline}
The DMARC policy of a domain, with the system DNS. Result: {domain, org_domain, found, record_domain, record, policy (for this domain: sp for a subdomain), tags, error, problems, offline}
Parameters
domain: A domain, an address or a From header (Jo) - String - required
domain: A domain, an address or a From header (Jo
admin
mail dmarc_record "sub.example.test"
mentdb
{"domain": "sub.example.test", "org_domain": "example.test", "found": true, "record_domain": "example.test", "record": "v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc@example.test; adkim=s; pct=100", "policy": "quarantine", "tags": {"v": "DMARC1", "p": "reject", "sp": "quarantine", "np": "quarantine", "t": "n", "adkim": "s", "aspf": "r", "pct": 100, "rua": ["mailto:dmarc@example.test"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": [], "offline": false}
mail dmarc_record <domain> <json_params>
Description
The DMARC policy with parameters: public_suffixes (a JSON array added to the built-in list), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
The DMARC policy with parameters: public_suffixes (a JSON array added to the built-in list), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Parameters
domain: A domain, an address or a From header - String - required
json_params: The parameters, as a JSON object - String - required
domain: A domain, an address or a From header - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail dmarc_record "example.com" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "example.com", "org_domain": "example.com", "found": true, "record_domain": "example.com", "record": "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com", "policy": "reject", "tags": {"v": "DMARC1", "p": "reject", "sp": "quarantine", "np": "quarantine", "t": "n", "adkim": "s", "aspf": "r", "pct": 100, "rua": ["mailto:dmarc-reports@example.com"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": [], "offline": true}
A subdomain without record: the record of the organizational domain, with sp
admin
mail dmarc_record "Billing <billing@eu.mail.example.com>" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "eu.mail.example.com", "org_domain": "example.com", "found": true, "record_domain": "example.com", "record": "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com", "policy": "quarantine", "tags": {"v": "DMARC1", "p": "reject", "sp": "quarantine", "np": "quarantine", "t": "n", "adkim": "s", "aspf": "r", "pct": 100, "rua": ["mailto:dmarc-reports@example.com"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": [], "offline": true}
co.uk is a public suffix
admin
mail dmarc_record "shop.example.co.uk" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "shop.example.co.uk", "org_domain": "example.co.uk", "found": true, "record_domain": "example.co.uk", "record": "v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk", "policy": "quarantine", "tags": {"v": "DMARC1", "p": "quarantine", "sp": "quarantine", "np": "quarantine", "t": "n", "adkim": "r", "aspf": "r", "pct": 25, "rua": ["mailto:d@example.co.uk"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": [], "offline": true}
An invalid p with a valid rua: read as p=none
admin
mail dmarc_record "nop.example" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "nop.example", "org_domain": "nop.example", "found": true, "record_domain": "nop.example", "record": "v=DMARC1; rua=mailto:d@nop.example; p=always", "policy": "none", "tags": {"v": "DMARC1", "p": "none", "sp": "none", "np": "none", "t": "n", "adkim": "r", "aspf": "r", "pct": 100, "rua": ["mailto:d@nop.example"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": ["invalid p=always: read as p=none because rua is valid"], "offline": true}
An invalid sp without rua: the record is ignored
admin
mail dmarc_record "badsp.example" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "badsp.example", "org_domain": "badsp.example", "found": false, "record_domain": null, "record": null, "policy": null, "tags": null, "error": null, "problems": ["invalid sp=strict: the record is ignored"], "offline": true}
No record
admin
mail dmarc_record "example.org" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"domain": "example.org", "org_domain": "example.org", "found": false, "record_domain": null, "record": null, "policy": null, "tags": null, "error": null, "problems": [], "offline": true}
Fixed result from a real call on a local test server (127.0.0.1): a real DNS server
admin
mail dmarc_record "sub.example.test" "{\"dns_server\": \"127.0.0.1:26053\"}"
mentdb
{"domain": "sub.example.test", "org_domain": "example.test", "found": true, "record_domain": "example.test", "record": "v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc@example.test; adkim=s; pct=100", "policy": "quarantine", "tags": {"v": "DMARC1", "p": "reject", "sp": "quarantine", "np": "quarantine", "t": "n", "adkim": "s", "aspf": "r", "pct": 100, "rua": ["mailto:dmarc@example.test"], "ruf": [], "fo": "0", "rf": "afrf", "ri": 86400}, "error": null, "problems": [], "offline": false}
mail dmarc_evaluate <from> <json_auth>
Description
DMARC result of a message from the SPF and DKIM results, with the system DNS. Result: {from_domain, org_domain, dmarc, disposition, policy, pct, sampled, spf_aligned, dkim_aligned, spf, spf_domain, dkim_domain, adkim, aspf, record_domain, record, reason, problems}
DMARC result of a message from the SPF and DKIM results, with the system DNS. Result: {from_domain, org_domain, dmarc, disposition, policy, pct, sampled, spf_aligned, dkim_aligned, spf, spf_domain, dkim_domain, adkim, aspf, record_domain, record, reason, problems}
Parameters
from: The domain of the From header (a domain, an address or the header) - String - required
json_auth: The results: {spf: {result, domain}, dkim: [{result, domain}]}, or the results of mail spf_check and mail dkim_verify - String - required
from: The domain of the From header (a domain, an address or the header) - String - required
json_auth: The results: {spf: {result, domain}, dkim: [{result, domain}]}, or the results of mail spf_check and mail dkim_verify - String - required
admin
mail dmarc_evaluate "billing@sub.example.test" "{\"spf\": {\"result\": \"pass\", \"domain\": \"example.test\"}}"
mentdb
{"from_domain": "sub.example.test", "org_domain": "example.test", "dmarc": "pass", "disposition": "none", "policy": "quarantine", "pct": 100, "sampled": true, "spf_aligned": true, "dkim_aligned": false, "spf": "pass", "spf_domain": "example.test", "dkim_domain": null, "adkim": "s", "aspf": "r", "record_domain": "example.test", "record": "v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc@example.test; adkim=s; pct=100", "reason": "SPF passes and is aligned (example.test)", "problems": []}
mail dmarc_evaluate <from> <json_auth> <json_params>
Description
DMARC result with parameters: record (the DMARC record to use, without DNS), sample (0 to 99: the fixed draw of pct), public_suffixes, records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
DMARC result with parameters: record (the DMARC record to use, without DNS), sample (0 to 99: the fixed draw of pct), public_suffixes, records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Parameters
from: The domain of the From header - String - required
json_auth: The SPF and DKIM results - String - required
json_params: The parameters, as a JSON object - String - required
from: The domain of the From header - String - required
json_auth: The SPF and DKIM results - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail dmarc_evaluate "billing@example.com" "{\"spf\": {\"result\": \"fail\", \"domain\": \"bounces.mailer.example.net\"}, \"dkim\": [{\"result\": \"pass\", \"domain\": \"example.com\"}]}" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"from_domain": "example.com", "org_domain": "example.com", "dmarc": "pass", "disposition": "none", "policy": "reject", "pct": 100, "sampled": true, "spf_aligned": false, "dkim_aligned": true, "spf": "fail", "spf_domain": "bounces.mailer.example.net", "dkim_domain": "example.com", "adkim": "s", "aspf": "r", "record_domain": "example.com", "record": "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com", "reason": "DKIM passes and is aligned (example.com)", "problems": []}
adkim=s: a signature of a subdomain is not aligned; SPF of the subdomain is aligned (aspf=r)
admin
mail dmarc_evaluate "billing@example.com" "{\"spf\": {\"result\": \"pass\", \"domain\": \"bounce.example.com\"}, \"dkim\": [{\"result\": \"pass\", \"domain\": \"mail.example.com\"}]}" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"from_domain": "example.com", "org_domain": "example.com", "dmarc": "pass", "disposition": "none", "policy": "reject", "pct": 100, "sampled": true, "spf_aligned": true, "dkim_aligned": false, "spf": "pass", "spf_domain": "bounce.example.com", "dkim_domain": null, "adkim": "s", "aspf": "r", "record_domain": "example.com", "record": "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com", "reason": "SPF passes and is aligned (bounce.example.com)", "problems": []}
Nothing aligned: reject
admin
mail dmarc_evaluate "billing@example.com" "{\"spf\": {\"result\": \"pass\", \"domain\": \"mailer.example.net\"}, \"dkim\": [{\"result\": \"pass\", \"domain\": \"mailer.example.net\"}]}" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}}"
mentdb
{"from_domain": "example.com", "org_domain": "example.com", "dmarc": "fail", "disposition": "reject", "policy": "reject", "pct": 100, "sampled": true, "spf_aligned": false, "dkim_aligned": false, "spf": "pass", "spf_domain": "mailer.example.net", "dkim_domain": null, "adkim": "s", "aspf": "r", "record_domain": "example.com", "record": "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com", "reason": "neither SPF nor DKIM passes with a domain aligned with example.com", "problems": []}
pct=25: a draw of 60 is outside the sample, quarantine becomes none
admin
mail dmarc_evaluate "shop.example.co.uk" "{\"spf\": {\"result\": \"softfail\", \"domain\": \"shop.example.co.uk\"}}" "{\"records\": {\"_dmarc.example.com\": {\"TXT\": [\"v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=100; rua=mailto:dmarc-reports@example.com\"]}, \"_dmarc.example.co.uk\": {\"TXT\": [\"v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk\"]}, \"_dmarc.nop.example\": {\"TXT\": [\"v=DMARC1; rua=mailto:d@nop.example; p=always\"]}, \"_dmarc.badsp.example\": {\"TXT\": [\"v=DMARC1; p=reject; sp=strict\"]}}, \"sample\": 60}"
mentdb
{"from_domain": "shop.example.co.uk", "org_domain": "example.co.uk", "dmarc": "fail", "disposition": "none", "policy": "quarantine", "pct": 25, "sampled": false, "spf_aligned": false, "dkim_aligned": false, "spf": "softfail", "spf_domain": "shop.example.co.uk", "dkim_domain": null, "adkim": "r", "aspf": "r", "record_domain": "example.co.uk", "record": "v=DMARC1; p=quarantine; pct=25; rua=mailto:d@example.co.uk", "reason": "neither SPF nor DKIM passes with a domain aligned with shop.example.co.uk", "problems": []}
A record given directly
admin
mail dmarc_evaluate "news@example.org" "{\"spf\": {\"result\": \"neutral\", \"domain\": \"example.org\"}}" "{\"record\": \"v=DMARC1; p=quarantine; aspf=s\"}"
mentdb
{"from_domain": "example.org", "org_domain": "example.org", "dmarc": "fail", "disposition": "quarantine", "policy": "quarantine", "pct": 100, "sampled": true, "spf_aligned": false, "dkim_aligned": false, "spf": "neutral", "spf_domain": "example.org", "dkim_domain": null, "adkim": "r", "aspf": "s", "record_domain": "example.org", "record": "v=DMARC1; p=quarantine; aspf=s", "reason": "neither SPF nor DKIM passes with a domain aligned with example.org", "problems": []}
Used in use cases (1 recipe)
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
mail dkim_verify <eml_text_or_path>
Description
Check the DKIM signatures of a message, with the system DNS
Check the DKIM signatures of a message, with the system DNS
Parameters
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
admin
mail dkim_verify "tmp/mail/rfc8463.eml"
mentdb
{"result": "pass", "count": 2, "signatures": [{"result": "pass", "domain": "football.example.com", "selector": "brisbane", "algorithm": "ed25519-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 256, "reason": null}, {"result": "pass", "domain": "football.example.com", "selector": "test", "algorithm": "rsa-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 1024, "reason": null}], "offline": false}
mail dkim_verify <eml_text_or_path> <json_params>
Description
Check the DKIM signatures with parameters: now (to check x= at another date), source (auto, text or path), max_bytes (25 MB, up to 200 MB), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Check the DKIM signatures with parameters: now (to check x= at another date), source (auto, text or path), max_bytes (25 MB, up to 200 MB), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Parameters
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
json_params: The parameters, as a JSON object - String - required
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail dkim_verify "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=brisbane; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=/gCrinpcQOoIfuHNQIbq4pgh9kyIK3AQUdt9OdqQehSwhEIug4D11Bus Fa3bT3FY5OsU7ZbnKELq+eXdp1Q1Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=test; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=F45dVWDfMbQDGHJFlXUNB2HKfbCeLRyhDXgFpEL8GwpsRe0IeIixNTe3 DhCVlUrSjV4BwcVcOF6+FF3Zo9Rpo1tFOeS9mPYQTnGdaSGsgeefOsk2Jz dA+L10TeYt9BgDfQNZtKdN1WO//KgIqXP7OdEFE4LjFYNcUxZQ4FADY+8= From: Joe SixPack <joe@football.example.com> To: Suzie Q <suzie@shopping.example.net> Subject: Is dinner ready? Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Message-ID: <20030712040037.46341.5F8J@football.example.com> Hi. We lost the game. Are you hungry yet? Joe. " "{\"records\": {\"brisbane._domainkey.football.example.com\": {\"TXT\": [\"v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=\"]}, \"test._domainkey.football.example.com\": {\"TXT\": [\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB\"]}}}"
mentdb
{"result": "pass", "count": 2, "signatures": [{"result": "pass", "domain": "football.example.com", "selector": "brisbane", "algorithm": "ed25519-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 256, "reason": null}, {"result": "pass", "domain": "football.example.com", "selector": "test", "algorithm": "rsa-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 1024, "reason": null}], "offline": true}
The same message with another Subject
admin
mail dkim_verify "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=brisbane; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=/gCrinpcQOoIfuHNQIbq4pgh9kyIK3AQUdt9OdqQehSwhEIug4D11Bus Fa3bT3FY5OsU7ZbnKELq+eXdp1Q1Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=test; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=F45dVWDfMbQDGHJFlXUNB2HKfbCeLRyhDXgFpEL8GwpsRe0IeIixNTe3 DhCVlUrSjV4BwcVcOF6+FF3Zo9Rpo1tFOeS9mPYQTnGdaSGsgeefOsk2Jz dA+L10TeYt9BgDfQNZtKdN1WO//KgIqXP7OdEFE4LjFYNcUxZQ4FADY+8= From: Joe SixPack <joe@football.example.com> To: Suzie Q <suzie@shopping.example.net> Subject: Is lunch ready? Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Message-ID: <20030712040037.46341.5F8J@football.example.com> Hi. We lost the game. Are you hungry yet? Joe. " "{\"records\": {\"brisbane._domainkey.football.example.com\": {\"TXT\": [\"v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=\"]}, \"test._domainkey.football.example.com\": {\"TXT\": [\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB\"]}}}"
mentdb
{"result": "fail", "count": 2, "signatures": [{"result": "fail", "domain": "football.example.com", "selector": "brisbane", "algorithm": "ed25519-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 256, "reason": "the signature does not match: a signed header was changed, or the key is not the right one"}, {"result": "fail", "domain": "football.example.com", "selector": "test", "algorithm": "rsa-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": 1024, "reason": "the signature does not match: a signed header was changed, or the key is not the right one"}], "offline": true}
A message signed by mail dkim_sign (next function)
admin
mail dkim_verify "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=example.com; s=mail2026; t=1794301200; h=from:subject:date:to:message-id:from; bh=tEoBPF7+f6jRPwGWYbLCMyVcdmZlEbocYDaK6u9Dxls=; b=CrLOOdt+0O1VTVKzs6Q15RUp51U1fWNDMsUbby/yTyCZwd+bEWfnBYp1DV+5Ks7oQJaF5+6K TfXwJF0vpigOCA== From: Billing <billing@example.com> To: client@example.net Subject: Invoice 2026-114 Date: Tue, 10 Nov 2026 09:00:00 +0000 Message-ID: <inv-2026-114@example.com> Your invoice is attached. " "{\"records\": {\"mail2026._domainkey.example.com\": {\"TXT\": [\"v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=\"]}}}"
mentdb
{"result": "pass", "count": 1, "signatures": [{"result": "pass", "domain": "example.com", "selector": "mail2026", "algorithm": "ed25519-sha256", "canonicalization": "relaxed/relaxed", "identity": null, "headers": ["from", "subject", "date", "to", "message-id", "from"], "body_length": null, "timestamp": "2026-11-10T09:00:00Z", "expiration": null, "body_hash_ok": true, "key_bits": 256, "reason": null}], "offline": true}
A From added above the signed message: permerror
admin
mail dkim_verify "From: CEO <ceo@attacker.example> DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=example.com; s=mail2026; t=1794301200; h=from:subject:date:to:message-id:from; bh=tEoBPF7+f6jRPwGWYbLCMyVcdmZlEbocYDaK6u9Dxls=; b=CrLOOdt+0O1VTVKzs6Q15RUp51U1fWNDMsUbby/yTyCZwd+bEWfnBYp1DV+5Ks7oQJaF5+6K TfXwJF0vpigOCA== From: Billing <billing@example.com> To: client@example.net Subject: Invoice 2026-114 Date: Tue, 10 Nov 2026 09:00:00 +0000 Message-ID: <inv-2026-114@example.com> Your invoice is attached. " "{\"records\": {\"mail2026._domainkey.example.com\": {\"TXT\": [\"v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=\"]}}}"
mentdb
{"result": "permerror", "count": 1, "signatures": [{"result": "permerror", "domain": "example.com", "selector": "mail2026", "algorithm": "ed25519-sha256", "canonicalization": null, "identity": null, "headers": null, "body_length": null, "timestamp": null, "expiration": null, "body_hash_ok": null, "key_bits": null, "reason": "the message has 2 From headers: a From may have been added (RFC 6376 8.15)"}], "offline": true}
No key in DNS
admin
mail dkim_verify "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=brisbane; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=/gCrinpcQOoIfuHNQIbq4pgh9kyIK3AQUdt9OdqQehSwhEIug4D11Bus Fa3bT3FY5OsU7ZbnKELq+eXdp1Q1Dw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=football.example.com; i=@football.example.com; q=dns/txt; s=test; t=1528637909; h=from : to : subject : date : message-id : from : subject : date; bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=; b=F45dVWDfMbQDGHJFlXUNB2HKfbCeLRyhDXgFpEL8GwpsRe0IeIixNTe3 DhCVlUrSjV4BwcVcOF6+FF3Zo9Rpo1tFOeS9mPYQTnGdaSGsgeefOsk2Jz dA+L10TeYt9BgDfQNZtKdN1WO//KgIqXP7OdEFE4LjFYNcUxZQ4FADY+8= From: Joe SixPack <joe@football.example.com> To: Suzie Q <suzie@shopping.example.net> Subject: Is dinner ready? Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT) Message-ID: <20030712040037.46341.5F8J@football.example.com> Hi. We lost the game. Are you hungry yet? Joe. " "{\"records\": {}}"
mentdb
{"result": "permerror", "count": 2, "signatures": [{"result": "permerror", "domain": "football.example.com", "selector": "brisbane", "algorithm": "ed25519-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": null, "reason": "no key at brisbane._domainkey.football.example.com"}, {"result": "permerror", "domain": "football.example.com", "selector": "test", "algorithm": "rsa-sha256", "canonicalization": "relaxed/relaxed", "identity": "@football.example.com", "headers": ["from", "to", "subject", "date", "message-id", "from", "subject", "date"], "body_length": null, "timestamp": "2018-06-10T13:38:29Z", "expiration": null, "body_hash_ok": true, "key_bits": null, "reason": "no key at test._domainkey.football.example.com"}], "offline": true}
A message without signature
admin
mail dkim_verify "From: Billing <billing@example.com> To: client@example.net Subject: Invoice 2026-114 Date: Tue, 10 Nov 2026 09:00:00 +0000 Message-ID: <inv-2026-114@example.com> Your invoice is attached. " "{\"records\": {}}"
mentdb
{"result": "none", "count": 0, "signatures": [], "offline": true}
Used in use cases (1 recipe)
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
mail dkim_sign <eml_text_or_path> <json_params>
Description
Sign a message with DKIM. Parameters: domain (d=) and selector (s=), private_key (the name of a secret: secret set) or private_key_file; headers (the headers to sign, a JSON array or from:to:subject; by default From, Reply-To, Subject, Date, To, Cc, Message-ID, In-Reply-To, References, MIME-Version, Content-Type, Content-Transfer-Encoding and the List- headers that the message has), canonicalization (relaxed/relaxed), identity (i=), body_length (false: l=), timestamp (true: t=), expire_seconds (x=), now, output (message: the signed message; header: the DKIM-Signature only; json: {dkim_signature, message, algorithm, dns_name, dns_record}), source, max_bytes
Sign a message with DKIM. Parameters: domain (d=) and selector (s=), private_key (the name of a secret: secret set) or private_key_file; headers (the headers to sign, a JSON array or from:to:subject; by default From, Reply-To, Subject, Date, To, Cc, Message-ID, In-Reply-To, References, MIME-Version, Content-Type, Content-Transfer-Encoding and the List- headers that the message has), canonicalization (relaxed/relaxed), identity (i=), body_length (false: l=), timestamp (true: t=), expire_seconds (x=), now, output (message: the signed message; header: the DKIM-Signature only; json: {dkim_signature, message, algorithm, dns_name, dns_record}), source, max_bytes
Parameters
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
json_params: The parameters, as a JSON object - String - required
eml_text_or_path: The whole message (headers and body) as text, or the path of an .eml file (same rights as file load) - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail dkim_sign "From: Billing <billing@example.com> To: client@example.net Subject: Invoice 2026-114 Date: Tue, 10 Nov 2026 09:00:00 +0000 Message-ID: <inv-2026-114@example.com> Your invoice is attached. " "{\"domain\": \"example.com\", \"selector\": \"mail2026\", \"private_key\": \"dkim_doc_key\", \"now\": \"2026-11-10T09:00:00Z\", \"output\": \"header\"}"
mentdb
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=example.com; s=mail2026; t=1794301200; h=from:subject:date:to:message-id:from; bh=tEoBPF7+f6jRPwGWYbLCMyVcdmZlEbocYDaK6u9Dxls=; b=CrLOOdt+0O1VTVKzs6Q15RUp51U1fWNDMsUbby/yTyCZwd+bEWfnBYp1DV+5Ks7oQJaF5+6K TfXwJF0vpigOCA==
json: also the DNS record to publish
admin
mail dkim_sign "From: Billing <billing@example.com> To: client@example.net Subject: Invoice 2026-114 Date: Tue, 10 Nov 2026 09:00:00 +0000 Message-ID: <inv-2026-114@example.com> Your invoice is attached. " "{\"domain\": \"example.com\", \"selector\": \"mail2026\", \"private_key\": \"dkim_doc_key\", \"now\": \"2026-11-10T09:00:00Z\", \"output\": \"json\", \"expire_seconds\": 604800}"
mentdb
{"dkim_signature": "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=example.com; s=mail2026;\ \tt=1794301200; x=1794906000; h=from:subject:date:to:message-id:from;\ \tbh=tEoBPF7+f6jRPwGWYbLCMyVcdmZlEbocYDaK6u9Dxls=;\ \tb=nmZUTHahqj4MktKF+n42qizjJytATWPI7KjZsAKcfnMfSwA5qMaoahvDb0/uszKJtRR0n6C5\ \t XOMvT0L/S8ygCw==\ ", "message": "DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=example.com; s=mail2026;\ \tt=1794301200; x=1794906000; h=from:subject:date:to:message-id:from;\ \tbh=tEoBPF7+f6jRPwGWYbLCMyVcdmZlEbocYDaK6u9Dxls=;\ \tb=nmZUTHahqj4MktKF+n42qizjJytATWPI7KjZsAKcfnMfSwA5qMaoahvDb0/uszKJtRR0n6C5\ \t XOMvT0L/S8ygCw==\ From: Billing <billing@example.com>\ To: client@example.net\ Subject: Invoice 2026-114\ Date: Tue, 10 Nov 2026 09:00:00 +0000\ Message-ID: <inv-2026-114@example.com>\ \ Your invoice is attached.\ ", "algorithm": "ed25519-sha256", "dns_name": "mail2026._domainkey.example.com", "dns_record": "v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo="}
A message without From
admin
mail dkim_sign "Subject: x body" "{\"domain\": \"example.com\", \"selector\": \"mail2026\", \"private_key\": \"dkim_doc_key\", \"now\": \"2026-11-10T09:00:00Z\"}"
mentdb
ERROR: Sorry, an error appears (the message has no From header: DKIM always signs it).
Used in use cases (1 recipe)
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Security engineer › Decide what to do with a received invoice mail: SPF, DKIM and DMARC
Often used with
mail dkim_verify · mail dmarc_evaluate · mail spf_check · secret set · string replace
mail dkim_verify · mail dmarc_evaluate · mail spf_check · secret set · string replace
mail address_check <address>
Description
Check the syntax of an address, then its domain in the system DNS. Result: {address, valid, reason, local, domain, domain_ascii, normalized, smtputf8, quoted, ip_literal, dns_checked, deliverable, mx, fallback, offline}
Check the syntax of an address, then its domain in the system DNS. Result: {address, valid, reason, local, domain, domain_ascii, normalized, smtputf8, quoted, ip_literal, dns_checked, deliverable, mx, fallback, offline}
Parameters
address: The address (a header form Name is accepted) - String - required
address: The address (a header form Name is accepted) - String - required
admin
mail address_check "jo@example.test"
mentdb
{"address": "jo@example.test", "valid": true, "reason": "the domain has mail servers (MX)", "local": "jo", "domain": "example.test", "domain_ascii": "example.test", "normalized": "jo@example.test", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": true, "mx": [{"priority": 10, "exchange": "mx1.example.test"}, {"priority": 20, "exchange": "mx2.example.test"}], "fallback": null, "offline": false}
mail address_check <address> <json_params>
Description
Check an address with parameters: dns (true; false checks the syntax only), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Check an address with parameters: dns (true; false checks the syntax only), records (a JSON object {name: {TYPE: [values]}} that replaces DNS: A, AAAA, MX ("10 mx.example.com"), TXT, PTR, CNAME; a name that is not there does not exist; "SERVFAIL": true makes the types without values fail), dns_server (ip, name or ip:port; the resolvers of the system by default), timeout_ms (5000)
Parameters
address: The address - String - required
json_params: The parameters, as a JSON object - String - required
address: The address - String - required
json_params: The parameters, as a JSON object - String - required
admin
mail address_check "Jo Martin <jo.martin+news@example.com>" "{\"dns\": false}"
mentdb
{"address": "jo.martin+news@example.com", "valid": true, "reason": "valid syntax; DNS not checked", "local": "jo.martin+news", "domain": "example.com", "domain_ascii": "example.com", "normalized": "jo.martin+news@example.com", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": false, "deliverable": null, "mx": [], "fallback": null, "offline": false}
Two dots
admin
mail address_check "jo..martin@example.com" "{\"dns\": false}"
mentdb
{"address": "jo..martin@example.com", "valid": false, "reason": "a dot cannot start or end the part before @, or follow another dot", "local": null, "domain": null, "domain_ascii": null, "normalized": null, "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": false, "deliverable": null, "mx": [], "fallback": null, "offline": false}
An IDN domain and a UTF-8 local part, with MX
admin
mail address_check "josé@bücher.example" "{\"records\": {\"xn--bcher-kva.example\": {\"MX\": [\"10 mx1.xn--bcher-kva.example\", \"20 mx2.xn--bcher-kva.example\"]}}}"
mentdb
{"address": "josé@bücher.example", "valid": true, "reason": "the domain has mail servers (MX)", "local": "josé", "domain": "bücher.example", "domain_ascii": "xn--bcher-kva.example", "normalized": "josé@xn--bcher-kva.example", "smtputf8": true, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": true, "mx": [{"priority": 10, "exchange": "mx1.xn--bcher-kva.example"}, {"priority": 20, "exchange": "mx2.xn--bcher-kva.example"}], "fallback": null, "offline": true}
A null MX: the domain accepts no mail
admin
mail address_check "info@noreply.example" "{\"records\": {\"noreply.example\": {\"MX\": [\"0 .\"]}}}"
mentdb
{"address": "info@noreply.example", "valid": true, "reason": "the domain says that it accepts no mail (null MX, RFC 7505)", "local": "info", "domain": "noreply.example", "domain_ascii": "noreply.example", "normalized": "info@noreply.example", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": false, "mx": [], "fallback": null, "offline": true}
No MX: the A record receives the mail
admin
mail address_check "info@small.example" "{\"records\": {\"small.example\": {\"A\": [\"192.0.2.8\"]}}}"
mentdb
{"address": "info@small.example", "valid": true, "reason": "no MX: mail goes to the A record of the domain (RFC 5321 5.1)", "local": "info", "domain": "small.example", "domain_ascii": "small.example", "normalized": "info@small.example", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": true, "mx": [], "fallback": "A", "offline": true}
A domain that does not exist
admin
mail address_check "info@nowhere.example" "{\"records\": {}}"
mentdb
{"address": "info@nowhere.example", "valid": true, "reason": "the domain does not exist", "local": "info", "domain": "nowhere.example", "domain_ascii": "nowhere.example", "normalized": "info@nowhere.example", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": false, "mx": [], "fallback": null, "offline": true}
Fixed result from a real call on a local test server (127.0.0.1): a real DNS server, a domain without MX
admin
mail address_check "jo@nomx.test" "{\"dns_server\": \"127.0.0.1:26053\"}"
mentdb
{"address": "jo@nomx.test", "valid": true, "reason": "no MX: mail goes to the A record of the domain (RFC 5321 5.1)", "local": "jo", "domain": "nomx.test", "domain_ascii": "nomx.test", "normalized": "jo@nomx.test", "smtputf8": false, "quoted": false, "ip_literal": false, "dns_checked": true, "deliverable": true, "mx": [], "fallback": "A", "offline": false}
Used in use cases (1 recipe)
Sales & marketing analyst › Clean the addresses of a newsletter before sending
Sales & marketing analyst › Clean the addresses of a newsletter before sending
