How can I use custom rules?
With custom rules, you can override verification responses based on your own criteria. This helps you treat certain email types in a specific way, such as marking free email providers as invalid or classifying deliverable role-based emails as safe.
Key Concepts:
- • You can view a sample JSON response by performing a single email verification.
- • Use dot.notation to reference fields (e.g.,
syntax.domain
). - • Conditions support partial matches by default — if the value contains the string, it matches.
- • Use regex: prefix for regex-based matching (e.g.,
"input":"regex:[.]+"
). - • Combine conditions using AND and OR for complex logic trees.
- • Actions also use dot.notation to override values (e.g.,
misc.is_disposable:true
).
Formatting:
Fields are referenced with dot.notation. For example, if your response includes:
{"misc":{"is_free":false}}
You would reference this as misc.is_free
in your conditions or actions.
Basic Condition:
Mark all free email providers as invalid:
Condition:
{"misc.is_free":true}
Action:
{"is_reachable":"invalid"}
If misc.is_free
is true, is_reachable
becomes invalid.
Logical Operators (AND):
Consider role-based and deliverable emails as safe:
Condition:
{"logic":"AND","conditions":[
{"misc.is_role_account":true},
{"smtp.is_deliverable":true}
]}
Action:
{"is_reachable":"safe"}
Both conditions must be true. If it’s role-based and deliverable, the email is marked safe.
Logical Operators (OR):
From invalid to safe if domain or username matches certain criteria:
Condition:
{"logic":"AND","conditions":[
{"is_reachable":"invalid"},
{"logic":"OR","conditions":[
{"syntax.domain":"acmeservices.com"},
{"syntax.username":"sales"}
]}
]}
Action:
{"is_reachable":"safe"}
If the email is invalid AND (domain contains "acmeservices.com" OR username contains "sales"), it's marked as safe.
Partial Matching:
Mark any email address containing "yahoo.com" as invalid:
Condition:
{"syntax.domain":"yahoo.com"}
Action:
{"is_reachable":"invalid"}
Regex Matching:
Flag Gmail-style aliases or Emailnator patterns (e.g. [email protected]
) as invalid:
Condition:
{"logic":"AND","conditions":[
{"misc.is_free":true},
{"syntax.username":"regex:([.].*){2,}|\\+"}
]}
Action:
{"is_reachable": "invalid", "misc.is_disposable": "true"}
This marks free email addresses that contain either 2+ dots in the username or a +
symbol as invalid.