> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contiguity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Email

> Send emails using the Contiguity JavaScript SDK.

Send with `html`, `text`, or both at the top level:

```typescript theme={null}
const res = await contiguity.email.send({
  to: ["user@example.com", "ops@example.com"],
  from: "Your App <no-reply@yourapp.com>",
  subject: "Welcome!",
  html: "<h1>Hello</h1>",
  reply_to: "support@yourapp.com",
  cc: "manager@example.com"
});
```

> [!NOTE]
>
> Providing content via `body: { text, html, react }` is deprecated but still supported. Prefer top-level `html`, `text`, and `react`.

## React Email

Pass a React Email component as `react`; the SDK renders it to HTML and plain text before sending. Install `@react-email/render` and its peer deps when using this:

> [tab] Bun
>
> ```bash theme={null}
> bun add @react-email/render react react-dom
> ```

> [tab] pnpm
>
> ```bash theme={null}
> pnpm add @react-email/render react react-dom
> ```

> [tab] npm
>
> ```bash theme={null}
> npm install @react-email/render react react-dom
> ```

> [tab] Yarn
>
> ```bash theme={null}
> yarn add @react-email/render react react-dom
> ```

Define a component (e.g. `Email.tsx`):

```tsx theme={null}
import * as React from 'react';
import { Html, Button } from "@react-email/components";

export function Email(props) {
  const { url } = props;

  return (
    <Html lang="en">
      <Button href={url}>Click me</Button>
    </Html>
  );
}

export default Email;
```

Then pass it to `react`:

```typescript theme={null}
import { Email } from "./Email";

await contiguity.email.send({
  to: "user@example.com",
  from: "Your App <no-reply@yourapp.com>",
  subject: "Welcome",
  react: <Email url="https://example.com" />,
});
```

## Parameters

### email.send(params)

**to** `string | string[]` *required*

Recipient email or array of recipients (max 10).

**from** `string` *required*

The sender's email address. Can include a display name: `"Your App <no-reply@yourapp.com>"`

**subject** `string` *required*

The email subject line.

**html** `string`

HTML version of the email content. Use `html`, `text`, and/or `react` (one or more required).

**text** `string`

Plain text version of the email content.

**react** `ReactNode`

A React Email component; the SDK renders it to HTML and plain text. Requires `@react-email/render`, `react`, and `react-dom`.

**body** `object`

Deprecated. Use top-level `html`, `text`, and `react` instead. Still supported: `body: { text?, html?, react? }`.

**reply\_to** `string`

Email address for replies. If not specified, replies will go to the `from` address.

**cc** `string | string[]`

Carbon copy recipients. Can be a single email address or an array of addresses.

**bcc** `string | string[]`

Blind carbon copy recipients. Can be a single email address or an array of addresses.

**headers** `object[]`

Custom email headers as an array of objects with `name` and `value` properties.

**Header object structure**

**headers\[].name** `string` *required*

The header name (e.g., "X-Campaign").

**headers\[].value** `string` *required*

The header value.

### Response

**email\_id** `string`

Unique identifier for the sent email, used for tracking delivery status and analytics.

**metadata** `object`

Request metadata including ID, timestamp, and API version.

![](https://fake.img.com/nonexistent.jpg)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.