---
title: "client.Tools"
description: "Every method in this namespace: its signature, its parameters, what it returns and an example."
url: "https://openemail.uk/docs/csharp/reference/tools"
area: "C#"
category: "Reference"
---

# client.Tools

Every method in this namespace: its signature, its parameters, what it returns and an example.

## Methods

The free tools on the OpenEmail website: checks of the public mail records of any domain, which are its DMARC policy, its BIMI logo and a deliverability report across MX, SPF, DKIM, DMARC and BIMI, a reader for the sign-in code in a message, and the price of every plan for a usage. They need no scope.

### `Tools.CheckDmarcAsync`

Check a domain's DMARC policy

```csharp
Task<JsonObject> CheckDmarcAsync(
    string domain,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Reads the domain's DMARC record from public DNS, or the record of the organisational domain it inherits from, and says how strict it is and what is wrong with it, the DMARC checker on the OpenEmail website. `stage` is `missing`, `invalid`, `monitor` for `p=none`, `quarantine` or `reject`, and `issues` lists the problems written to be shown to a person.

**Parameters**

- `domain` (`string`, required): The domain to check, such as `acme.com`. An email address or a URL is read as its domain, and any public domain works, not only the ones in this workspace.
- `apiKey` (`string?`): Overrides the client's API key for this call only.
- `cancellationToken` (`CancellationToken`): Cancels the request.

**Returns**

A `JsonObject` with `domain`, `record`, `inheritedFrom`, every tag in `tags`, `stage` and `issues`.

**Example**

```csharp
var report = await client.Tools.CheckDmarcAsync("acme.com");

Console.WriteLine($"{report["stage"]} with p={report["tags"]?["p"]?.ToString() ?? "none"}");

foreach (var issue in report["issues"]?.AsArray() ?? [])
{
    Console.WriteLine($"- {issue}");
}
```

**Notes**

- Needs no scope: any key or access token for the workspace may run it.
- A domain that does not read as one is 422 `invalid_parameter` on `domain`, and DNS that did not answer is 503 `unreachable`, which is worth retrying.

Also available in: API [`GET /tools/dmarc`](https://openemail.uk/docs/api/reference/tools#get-tools-dmarc); TypeScript [`tools.checkDmarc()`](https://openemail.uk/docs/sdk/reference/tools#checkDmarc); Python [`tools.check_dmarc()`](https://openemail.uk/docs/python/reference/tools#checkDmarc); Ruby [`tools.check_dmarc`](https://openemail.uk/docs/ruby/reference/tools#checkDmarc); PHP [`tools->checkDmarc`](https://openemail.uk/docs/php/reference/tools#checkDmarc); Go [`Tools.CheckDmarc`](https://openemail.uk/docs/go/reference/tools#checkDmarc); Java [`tools().checkDmarc`](https://openemail.uk/docs/java/reference/tools#checkDmarc); CLI [`openemail tools check-dmarc`](https://openemail.uk/docs/cli/reference/tools#tools-check-dmarc).

### `Tools.CheckBimiAsync`

Check a domain's BIMI logo

```csharp
Task<JsonObject> CheckBimiAsync(
    string domain,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Reads the domain's BIMI record, fetches the logo it names and checks the DMARC policy beside it, since inboxes draw a logo only at `p=quarantine` or `p=reject`, the BIMI checker on the OpenEmail website. `status` is `present`, `partial` when the record is there but something stops inboxes showing the logo, `absent` or `invalid`, and `issues` says why.

**Parameters**

- `domain` (`string`, required): The domain to check, such as `acme.com`. An email address or a URL is read as its domain, and any public domain works, not only the ones in this workspace.
- `apiKey` (`string?`): Overrides the client's API key for this call only.
- `cancellationToken` (`CancellationToken`): Cancels the request.

**Returns**

A `JsonObject` with `record`, `logoUrl`, `authorityUrl`, `logoSvg`, `logoReachable`, `dmarcPolicy`, `dmarcEnforced`, `status` and `issues`.

**Example**

```csharp
var report = await client.Tools.CheckBimiAsync("acme.com");

if ((string?)report["status"] != "present")
{
    Console.WriteLine($"{string.Join(Environment.NewLine, report["issues"]?.AsArray() ?? [])}");
}
```

**Notes**

- Needs no scope: any key or access token for the workspace may run it.
- A domain that does not read as one is 422 `invalid_parameter` on `domain`, and DNS that did not answer is 503 `unreachable`, which is worth retrying.

Also available in: API [`GET /tools/bimi`](https://openemail.uk/docs/api/reference/tools#get-tools-bimi); TypeScript [`tools.checkBimi()`](https://openemail.uk/docs/sdk/reference/tools#checkBimi); Python [`tools.check_bimi()`](https://openemail.uk/docs/python/reference/tools#checkBimi); Ruby [`tools.check_bimi`](https://openemail.uk/docs/ruby/reference/tools#checkBimi); PHP [`tools->checkBimi`](https://openemail.uk/docs/php/reference/tools#checkBimi); Go [`Tools.CheckBimi`](https://openemail.uk/docs/go/reference/tools#checkBimi); Java [`tools().checkBimi`](https://openemail.uk/docs/java/reference/tools#checkBimi); CLI [`openemail tools check-bimi`](https://openemail.uk/docs/cli/reference/tools#tools-check-bimi).

### `Tools.CheckDeliverabilityAsync`

Check a domain's deliverability

```csharp
Task<JsonObject> CheckDeliverabilityAsync(
    string domain,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Checks the records a receiving mailbox reads before it trusts mail from the domain, the deliverability checker on the OpenEmail website: MX, SPF, DKIM at the selectors its mail provider uses, DMARC and BIMI. Each check says `pass`, `warn`, `fail` or `absent` with a verdict and notes, and `score` weighs them into 0 to 100, graded `A` to `F`.

**Parameters**

- `domain` (`string`, required): The domain to check, such as `acme.com`. An email address or a URL is read as its domain, and any public domain works, not only the ones in this workspace.
- `apiKey` (`string?`): Overrides the client's API key for this call only.
- `cancellationToken` (`CancellationToken`): Cancels the request.

**Returns**

A `JsonObject` with `score`, `grade`, `provider` and `checks`, a list of objects each with `id`, `label`, `status`, `verdict`, `record` and `notes`.

**Example**

```csharp
var report = await client.Tools.CheckDeliverabilityAsync("acme.com");

Console.WriteLine($"{report["grade"]} ({report["score"]}/100)");

foreach (var check in report["checks"]?.AsArray() ?? [])
{
    Console.WriteLine($"{check?["id"]} {check?["status"]} {check?["verdict"]}");
}
```

**Notes**

- Needs no scope: any key or access token for the workspace may run it.
- A domain that does not read as one is 422 `invalid_parameter` on `domain`, and DNS that did not answer is 503 `unreachable`, which is worth retrying.

Also available in: API [`GET /tools/deliverability`](https://openemail.uk/docs/api/reference/tools#get-tools-deliverability); TypeScript [`tools.checkDeliverability()`](https://openemail.uk/docs/sdk/reference/tools#checkDeliverability); Python [`tools.check_deliverability()`](https://openemail.uk/docs/python/reference/tools#checkDeliverability); Ruby [`tools.check_deliverability`](https://openemail.uk/docs/ruby/reference/tools#checkDeliverability); PHP [`tools->checkDeliverability`](https://openemail.uk/docs/php/reference/tools#checkDeliverability); Go [`Tools.CheckDeliverability`](https://openemail.uk/docs/go/reference/tools#checkDeliverability); Java [`tools().checkDeliverability`](https://openemail.uk/docs/java/reference/tools#checkDeliverability); CLI [`openemail tools check-deliverability`](https://openemail.uk/docs/cli/reference/tools#tools-check-deliverability).

### `Tools.ReadVerificationCodeAsync`

Read the sign-in code in a message

```csharp
Task<JsonObject> ReadVerificationCodeAsync(
    IReadOnlyDictionary<string, object?> body,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Finds the sign-in or verification code in a message you pass in, with the reader that puts a code at the top of a message in OpenEmail. Send the whole MIME source as `raw`, or the `subject` with `html` or `text`.

It answers only when it is sure: the message has to hold exactly one code worded as one, such as a verification code, a one-time code or a security code, in any of the common languages. Two different codes, or a number that could be an order, a booking, a meeting, a phone number or a promotion, leave `code` null.

It reads only what you send, so it cannot tell whether the sender is who it claims to be. The `verificationCode` that `Threads.GetAsync` returns on each message of your mailbox also requires the sender to pass authentication.

**Parameters**

- `raw` (`string`): The whole message as MIME source, as it was received. Wins over the other fields when it is set.
- `subject` (`string`): Subject line, at most 998 characters.
- `html` (`string`): HTML body. Links are left out before the code is looked for.
- `text` (`string`): Plain text body, used when there is no `html`.
- `apiKey` (`string?`): Overrides the client's API key for this call only.
- `cancellationToken` (`CancellationToken`): Cancels the request.

**Returns**

A `JsonObject` with `object` set to `verification_code` and `code`: the code as you would type it, digits only or capital letters and digits without spaces or dashes, or null when the reader is not sure.

**Example**

```csharp
var result = await client.Tools.ReadVerificationCodeAsync(new Body
{
    ["subject"] = "Your verification code",
    ["html"] = "<p>Your code is <b>396-696</b>. It expires in 10 minutes.</p>",
});

if (result["code"] is not null)
{
    Console.WriteLine($"{result["code"]}");
}

var fromSource = await client.Tools.ReadVerificationCodeAsync(new Body { ["raw"] = await File.ReadAllBytesAsync("message.eml") });

Console.WriteLine($"{fromSource["code"]?.ToString() ?? "No code"}");
```

**Notes**

- Needs no scope: any key or access token for the workspace may run it.
- Nothing is stored and no model is called, so it is safe to run on every message.
- A body with none of `raw`, `subject`, `html` or `text` is 422 `invalid_parameter`.

Also available in: API [`POST /tools/verification-code`](https://openemail.uk/docs/api/reference/tools#post-tools-verification-code); TypeScript [`tools.readVerificationCode()`](https://openemail.uk/docs/sdk/reference/tools#readVerificationCode); Python [`tools.read_verification_code()`](https://openemail.uk/docs/python/reference/tools#readVerificationCode); Ruby [`tools.read_verification_code`](https://openemail.uk/docs/ruby/reference/tools#readVerificationCode); PHP [`tools->readVerificationCode`](https://openemail.uk/docs/php/reference/tools#readVerificationCode); Go [`Tools.ReadVerificationCode`](https://openemail.uk/docs/go/reference/tools#readVerificationCode); Java [`tools().readVerificationCode`](https://openemail.uk/docs/java/reference/tools#readVerificationCode); CLI [`openemail tools read-verification-code`](https://openemail.uk/docs/cli/reference/tools#tools-read-verification-code).

### `Tools.EstimateCostAsync`

Estimate what OpenEmail costs for a usage

```csharp
Task<JsonObject> EstimateCostAsync(
    int? sends = null,
    int? domains = null,
    int? people = null,
    int? aiActions = null,
    string? interval = null,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Prices every plan for the usage you describe, as the cost calculator on the OpenEmail website does: the plan itself, the extra sends and AI actions it would bill, the monthly total, and whether the plan fits at all. A plan does not fit when the usage needs more domains than it includes, more than one person without team access, or more sends than it allows without billing extra. `cheapest` names the cheapest plan that fits.

Amounts are in US cents per month. With `interval:` set to `year`, the plan price is the monthly equivalent of paying yearly.

**Parameters**

- `sends` (`int?`): Emails sent in a month. Defaults to 0.
- `domains` (`int?`): Domains you send from. Defaults to 1.
- `people` (`int?`): People who use the workspace. Defaults to 1.
- `aiActions` (`int?`): AI actions in a day, such as drafts, rewrites and summaries. Defaults to 0.
- `interval` (`string?`): How you pay: `month` or `year`, as in `OpenEmail\Constants\BillingIntervals`. Defaults to `month`.
- `apiKey` (`string?`): Overrides the client's API key for this call only.
- `cancellationToken` (`CancellationToken`): Cancels the request.

**Returns**

A `JsonObject` with `object` set to `cost_estimate`, the `interval`, the `need` that was priced with its defaults filled in, every plan in `plans`, each an object with `plan`, `name`, `fits`, `blockers`, `baseCents`, `extraSends`, `sendsCents`, `extraAiActions`, `aiCents`, `extrasCents` and `totalCents`, and `cheapest`, the id of the cheapest plan that fits, or null when none does.

**Example**

```csharp
var estimate = await client.Tools.EstimateCostAsync(sends: 25000, domains: 2, people: 4, aiActions: 30);

Console.WriteLine(estimate.ToJsonString());
```

**Notes**

- Needs no scope: any key or access token for the workspace may run it.
- It prices the plans as they are sold today and reads nothing in the workspace.
- `blockers` names what a plan cannot carry: `domains`, `people` or `sends`, the values in `OpenEmail\Constants\PlanBlockers`.

Also available in: API [`GET /tools/cost`](https://openemail.uk/docs/api/reference/tools#get-tools-cost); TypeScript [`tools.estimateCost()`](https://openemail.uk/docs/sdk/reference/tools#estimateCost); Python [`tools.estimate_cost()`](https://openemail.uk/docs/python/reference/tools#estimateCost); Ruby [`tools.estimate_cost`](https://openemail.uk/docs/ruby/reference/tools#estimateCost); PHP [`tools->estimateCost`](https://openemail.uk/docs/php/reference/tools#estimateCost); Go [`Tools.EstimateCost`](https://openemail.uk/docs/go/reference/tools#estimateCost); Java [`tools().estimateCost`](https://openemail.uk/docs/java/reference/tools#estimateCost); CLI [`openemail tools estimate-cost`](https://openemail.uk/docs/cli/reference/tools#tools-estimate-cost).

### `Tools.CheckAddressAsync`

Check an email address

```csharp
Task<JsonObject> CheckAddressAsync(
    string email,
    bool? deep = null,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Says whether an address is worth sending to, the email checker on the OpenEmail website: `result` is `valid`, `risky`, `invalid` or `unknown`, and `reasons` says why. It checks the syntax, whether the domain takes mail at all, whether it is a throwaway domain or a shared address such as `info@`, and offers a correction in `suggestion` for a likely typo such as `gmial.com`. Run it on a sign-up form before the first message, or over a list before a broadcast.

With the `emails:read` scope, `workspace` also says what this workspace knows: whether it suppressed the address and when it last delivered to it or saw it bounce. It never shows another workspace's history, and without the scope it is null.

`deep` also asks whether the mailbox itself exists, in `checks.mailbox`. A deep check is billed per address through pay as you go and needs the `emails:send` scope. Without it the check is free and `checks.mailbox` is null.

**Parameters**

- `email` (`string`, required): The address to check, such as `ada@acme.com`.
- `deep` (`bool?`): Also ask whether the mailbox exists. Billed per address through pay as you go. Defaults to false.
- `cancellationToken` (`CancellationToken`): Cancels the request.
- `apiKey` (`string?`): Overrides the client's API key for this call only.

**Returns**

A `JsonObject` with `email`, `normalized`, `result`, `reasons`, `suggestion`, `checks`, `workspace` and `checkedAt`.

**Example**

```csharp
var check = await client.Tools.CheckAddressAsync("ada@gmial.com");

Console.WriteLine($"{check["email"]} is {check["result"]}: {string.Join(", ", check["reasons"]?.AsArray() ?? [])}");

if ((string?)check["suggestion"] is { } suggestion)
{
    Console.WriteLine($"Did you mean {suggestion}?");
}
```

**Notes**

- Needs no scope without `deep`: any key or access token for the workspace may run it.
- An address whose syntax is wrong is not an error: it returns `result` `invalid` and the reason `invalid_syntax`.
- With `deep`, a workspace where pay as you go is off, paused or not part of the plan is 409 `deep_check_unavailable`, a check that would pass its monthly limit is 409 `deep_check_limit_reached`, and a mailbox check that did not answer is 503 `deep_check_unavailable`. Nothing is billed for any of them.
- A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client `MaxRetries`, and on a 429 only when it carries a `Retry-After` of a minute or less.

Also available in: API [`GET /tools/address`](https://openemail.uk/docs/api/reference/tools#get-tools-address); TypeScript [`tools.checkAddress()`](https://openemail.uk/docs/sdk/reference/tools#checkAddress); Python [`tools.check_address()`](https://openemail.uk/docs/python/reference/tools#checkAddress); Ruby [`tools.check_address`](https://openemail.uk/docs/ruby/reference/tools#checkAddress); PHP [`tools->checkAddress`](https://openemail.uk/docs/php/reference/tools#checkAddress); Go [`Tools.CheckAddress`](https://openemail.uk/docs/go/reference/tools#checkAddress); Java [`tools().checkAddress`](https://openemail.uk/docs/java/reference/tools#checkAddress); CLI [`openemail tools check-address`](https://openemail.uk/docs/cli/reference/tools#tools-check-address).

### `Tools.CheckAddressesAsync`

Check several email addresses

```csharp
Task<JsonObject> CheckAddressesAsync(
    IReadOnlyDictionary<string, object?> body,
    string? apiKey = null,
    CancellationToken cancellationToken = default)
```

Checks up to 100 addresses in one call, each as `CheckAddressAsync` does, and returns them in the order they were sent. Use it to clean a list before importing it or sending a broadcast to it.

`deep` applies to every address and is billed for each one that reaches the mailbox check, through pay as you go, and needs the `emails:send` scope.

**Parameters**

- `emails` (`IEnumerable<string>`, required): The addresses to check, from 1 to 100.
- `deep` (`bool`): Also ask whether each mailbox exists. Billed per address through pay as you go. Defaults to false.
- `cancellationToken` (`CancellationToken`): Cancels the request.
- `apiKey` (`string?`): Overrides the client's API key for this call only.

**Returns**

A `JsonObject` with one object per address in `data`, in the order they were sent.

**Example**

```csharp
var checks = await client.Tools.CheckAddressesAsync(new Body
{
    ["emails"] = new[] { "ada@acme.com", "grace@example.com", "info@mailinator.com" },
});

foreach (var check in checks["data"]?.AsArray() ?? [])
{
    Console.WriteLine($"{check?["email"]} is {check?["result"]}");
}
```

**Notes**

- Needs no scope without `deep`: any key or access token for the workspace may run it.
- More than 100 addresses, or none, is 422 `invalid_parameter` on `emails`.
- It changes nothing, so it is safe to run again, but the SDK does not retry a POST.

Also available in: API [`POST /tools/addresses`](https://openemail.uk/docs/api/reference/tools#post-tools-addresses); TypeScript [`tools.checkAddresses()`](https://openemail.uk/docs/sdk/reference/tools#checkAddresses); Python [`tools.check_addresses()`](https://openemail.uk/docs/python/reference/tools#checkAddresses); Ruby [`tools.check_addresses`](https://openemail.uk/docs/ruby/reference/tools#checkAddresses); PHP [`tools->checkAddresses`](https://openemail.uk/docs/php/reference/tools#checkAddresses); Go [`Tools.CheckAddresses`](https://openemail.uk/docs/go/reference/tools#checkAddresses); Java [`tools().checkAddresses`](https://openemail.uk/docs/java/reference/tools#checkAddresses); CLI [`openemail tools check-addresses`](https://openemail.uk/docs/cli/reference/tools#tools-check-addresses).
