---
title: Telemetry and privacy
description: Anonymous SDK and CLI analytics, redacted error reporting, storage, and opt-out behavior.
---

Core SDK and CLI telemetry are enabled by default. The first enabled run prints an opt-out notice to stderr and stores a random anonymous id plus the notice marker.

## Opt out

```bash
export EMAIL_SDK_TELEMETRY=0
# or
export DO_NOT_TRACK=1
```

```ts title="src/email.ts"
const email = createEmailClient({
  adapters: [adapter],
  telemetry: false,
});
```

`NODE_ENV=test` also disables capture. Repository tests use a Bun preload that sets `EMAIL_SDK_TELEMETRY=0` for every in-process run.

When disabled, telemetry does not write config, print the notice, or make network requests.

## Events

The current event names are `client created`, `email sent`, `email batch sent`, and `cli command run`.

Allowed facts include built-in adapter names, operation/command names, counts, success, durations, stable error codes, runtime and SDK versions, CI facts, and feature-presence booleans. Custom adapter names become `custom`.

## Error reports

Handled provider and unknown failures may produce a PostHog `$exception` event. Caller validation mistakes and unknown adapter names are excluded.

Error reporting limits cause depth, frames, message length, duplicate classes, and reports per process. It scrubs email addresses, URLs, quoted text, long tokens, home directories, and filesystem paths from messages and stacks.

## Data that is not collected

Telemetry does not collect message bodies, subjects, addresses, headers, attachments, credentials, idempotency keys, provider response bodies, URLs, or filesystem paths.

## Local state

The default state file is `~/.config/email-sdk/telemetry.json`, or `$XDG_CONFIG_HOME/email-sdk/telemetry.json` when `XDG_CONFIG_HOME` is set.

**[Observability plugin](/v1.0.0/docs/plugins/built-in/observability)**

Configure your own application log, metric, and trace events.
