# Hono

> Send your first email from a Hono route using the sendping SDK.

Send your first email from a Hono app using the `sendping` SDK. The SDK uses the standard `fetch` API and works on Node.js, Bun, Cloudflare Workers, and other edge runtimes. Install it with `npm install sendping`, import `SendPing`, and call `mb.emails.send()`.

## Prerequisites

- A SendPing [API key](https://www.sendping.co/docs/api-keys/overview).
- A [verified domain](https://www.sendping.co/docs/domains/managing) to send from.

## 1. Install the SDK

```bash
npm install sendping
```

## 2. Add your API key

Store your key in the environment. On Node.js or Bun it is available as `process.env.SENDPING_API_KEY`; on Cloudflare Workers it comes from the request context bindings (`c.env`).

**.env**

```ini
SENDPING_API_KEY=mb_xxxxxxxxx
```

## 3. Send email from a route

Create `index.ts`, instantiate the SDK client, and call `mb.emails.send()` inside a route handler.

**index.ts**

```ts
import { Hono } from 'hono';
import { SendPing } from 'sendping';

const app = new Hono();
const mb = new SendPing(process.env.SENDPING_API_KEY!);

app.get('/', async (c) => {
  const { data, error } = await mb.emails.send({
    from: 'Acme <onboarding@yourdomain.com>',
    to: ['delivered@test.sendping.co'],
    subject: 'hello world',
    html: '<strong>it works!</strong>',
  });

  return c.json(error ? { error } : { data }, error ? 400 : 200);
});

export default app;
```

> **Note:** A successful call returns the created email's `id`. See the full request body in the [Send an email](https://www.sendping.co/docs/api/emails-send) reference.
