# The @sypnia/mail package

> One npm package with subpaths for servers, templates and webhooks.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://mail.docs.sypnia.com/tools/sdk/

For agents: @sypnia/mail subpaths: /server (send, sendBatch, cancel, events, suppressions, domains, verifyWebhook), /templates (local rendering for tests/previews), /react (React e-mail components to e-mail-safe HTML), CLI npx @sypnia/mail; createMail({apiKey} or {baseUrl}); no browser subpath (secret key); ESM + types; Node 20+, Bun, Deno.

| Import                   | For                                                                                                        |
| ------------------------ | ---------------------------------------------------------------------------------------------------------- |
| `@sypnia/mail/server`    | servers: `send`, `sendBatch`, `cancel`, events, suppressions, domains, `verifyWebhook`                     |
| `@sypnia/mail/templates` | rendering a template locally with data, for tests and previews                                             |
| `@sypnia/mail/react`     | writing templates as React components (`<Email>`, `<Button>`, `<Section>`) that render to e-mail-safe HTML |
| `npx @sypnia/mail`       | [the CLI](https://mail.docs.sypnia.com/tools/cli)                                                          |

```ts
import { createMail } from '@sypnia/mail/server';
const mail = createMail({ apiKey: process.env.SYPNIA_MAIL_KEY! });   // or { baseUrl } for your engine
```

There is no browser subpath: sending needs a secret key, so it always happens on a server, in a Sypnia Run function, or from Sypnia Data's auth. ESM with types, Node 20+, Bun and Deno.
