Skip to the documentation
C#

client.Analytics

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

Methods

The numbers behind the Analytics page: how mail arrives in the mailbox, and what became of the mail the workspace sent.

Analytics.MailboxAsync

Read how mail arrives

Scopesthreads:read
Signature
Task<JsonObject> MailboxAsync(    DateTimeOffset? from = null,    DateTimeOffset? to = null,    int? offsetMinutes = null,    string? grain = null,    string? address = null,    string? apiKey = null,    CancellationToken cancellationToken = default)

Returns how mail arrives, as the Analytics page of the app shows it, for a window, the last 30 days unless from: and to: say otherwise: how many conversations arrived and when, per grain bucket in days and per hour of the day in hours, the addresses they arrived at, the senders who wrote most, how many conversations wait on a reply for 1, 3 or 7 days or more, and the folders.

days is sparse: a bucket in which nothing arrived has no entry, so a chart must fill the gaps. offsetMinutes: shifts the boundaries so days and hours break where the reader's do, and series holds the per bucket counts of the top addresses and senders so each can be charted.

A key limited to particular addresses counts only the mail that arrived at them, and address: narrows everything to one address. An address the key does not reach counts nothing rather than failing.

Parameters

fromDateTimeOffset?

The start of the window. Defaults to 30 days before to:.

toDateTimeOffset?

The end of the window. Defaults to now.

offsetMinutesint?

Minutes east of UTC, from -840 to 840, defaulting to 0. Pass (int)TimeZoneInfo.Local.GetUtcOffset(DateTimeOffset.Now).TotalMinutes for the local zone.

grainstring?

Bucket width: minute, hour or day, defaulting to day.

addressstring?

Count only the mail delivered to this address.

apiKeystring?

Overrides the client's API key for this call only.

cancellationTokenCancellationToken

Cancels the request.

Returns

A JsonObject with object set to mailbox_insights, from, to, grain, offsetMinutes, scanned, days, hours, addresses, senders, senderCount, waiting, unattributed, folders and series.

Example

var insights = await client.Analytics.MailboxAsync(    from: DateTimeOffset.UtcNow.AddDays(-7),    offsetMinutes: (int)TimeZoneInfo.Local.GetUtcOffset(DateTimeOffset.Now).TotalMinutes); Console.WriteLine($"{insights["scanned"]} conversations from {insights["senderCount"]} senders"); foreach (var sender in insights["senders"]?.AsArray() ?? []){    Console.WriteLine($"{sender?["email"]} {sender?["count"]}");}

Notes

  • Read only, so the SDK retries it after a network failure like any other read.

  • from: after to: is a 422 invalid_parameter.

Also available in

API
GET /analytics/mailbox
TypeScript
nextmail.analytics.mailbox()
Python
analytics.mailbox()
Ruby
analytics.mailbox
PHP
analytics->mailbox
Go
Analytics.Mailbox
Java
analytics().mailbox
CLI
openemail analytics mailbox

Analytics.SendingAsync

Read what became of sent mail

Scopesemails:read
Signature
Task<JsonObject> SendingAsync(    int? days = null,    int? minutes = null,    int? offsetMinutes = null,    string? grain = null,    string? address = null,    DateTimeOffset? since = null,    DateTimeOffset? until = null,    string? recipient = null,    string? tag = null,    string? apiKey = null,    CancellationToken cancellationToken = default)

Returns the numbers behind the Analytics page of the app: what the workspace sent inside a window and what became of it. totals adds up the sends, recipients and test sends and how many were delivered, failed, bounced, complained about, uncertain or still pending, days cuts sent, delivered, failed, bounced and complained to grain buckets, and statuses, sources, senders and suppressed break the window down.

The window is days:, 30 by default and at most 365, or minutes:, which wins when both are sent. It ends at until:, now by default, and starts at since: when that is sent, or else at the beginning of its oldest bucket. Both come back as since and until. offsetMinutes: shifts the bucket boundaries so days break where the reader's do.

A key limited to particular addresses counts only the mail sent from them, and address: narrows everything to one address. recipient: and tag: narrow it further, to the mail that went to one address or carried one tag.

Parameters

daysint?

Window length in days, from 1 to 365, defaulting to 30.

minutesint?

Window length in minutes, which wins over days:.

offsetMinutesint?

Minutes east of UTC, from -840 to 840, defaulting to 0.

grainstring?

Bucket width: minute, hour or day, defaulting to day.

addressstring?

Count only the mail sent from this address.

sinceDateTimeOffset?

Start of the window, which wins over days: and minutes:. A window spans at most 365 days.

untilDateTimeOffset?

End of the window, not included, defaulting to now. since: after until: is a 422 invalid_parameter.

recipientstring?

Count only the mail that went to this address, and only its delivery to that address.

tagstring?

Count only the mail sent with this tag: name for any value, or name:value for one value.

apiKeystring?

Overrides the client's API key for this call only.

cancellationTokenCancellationToken

Cancels the request.

Returns

A JsonObject with object set to sending_analytics, since, until, grain, offsetMinutes, totals, days, statuses, sources, senders and suppressed.

Example

var analytics = await client.Analytics.SendingAsync(days: 7, grain: "day"); var totals = analytics["totals"]; Console.WriteLine($"{totals?["delivered"]} of {totals?["sends"]} delivered, {totals?["bounced"]} bounced"); foreach (var day in analytics["days"]?.AsArray() ?? []){    Console.WriteLine($"{day?["day"]}: {day?["sent"]} sent");}

Notes

  • Read only, so the SDK retries it after a network failure like any other read.

Also available in

API
GET /analytics/sending
TypeScript
nextmail.analytics.sending()
Python
analytics.sending()
Ruby
analytics.sending
PHP
analytics->sending
Go
Analytics.Sending
Java
analytics().sending
CLI
openemail analytics sending