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

# Send (& receive) emails using Inbound

> Learn how to send and receive emails using Vuemail and the Inbound Node.js SDK.

## 1. Install dependencies

Get the [@vuemaildev/vuemail](https://www.npmjs.com/package/@vuemaildev/vuemail) package and the [Inbound Node.js SDK](https://www.npmjs.com/package/inboundemail).

Make sure you have an account on [inbound](https://inbound.new), you will need an inbound API key.

```sh npm theme={null}
npm install inboundemail @vuemaildev/vuemail
```

```sh yarn theme={null}
yarn add inboundemail @vuemaildev/vuemail
```

```sh pnpm theme={null}
pnpm add inboundemail @vuemaildev/vuemail
```

```sh bun theme={null}
bun add inboundemail @vuemaildev/vuemail
```

## 2. Create an email using Vue

Start by building your email template in a `.vue` file.

```vue email.vue theme={null}
<script setup lang="ts">
import { Button, Html } from '@vuemaildev/vuemail';

const { url } = defineProps<{ url: string }>();
</script>

<template>
  <Html lang="en">
    <Button :href="url">Click me</Button>
  </Html>
</template>
```

## 3. Convert to HTML and send email

> [!NOTE]
>
> When integrating with other services, you need to convert your Vue template into HTML before sending, which is what `render` does.

Import the email template you just built, convert it into an HTML string, and use the Inbound SDK to send it.

```ts theme={null}
import { Inbound } from 'inboundemail';
import { render } from '@vuemaildev/vuemail';
import Email from './email.vue';

const inbound = new Inbound({
  apiKey: process.env.INBOUND_API_KEY,
});

await inbound.emails.send({
  from: 'you@example.com',
  to: 'user@gmail.com',
  subject: 'hello world',
  html: await render(Email, { url: 'https://example.com' }),
});
```

## 4. Reply to an email

Use the Inbound SDK to reply to an email with the same template you just created.

```ts theme={null}
import { Inbound } from 'inboundemail';
import { render } from '@vuemaildev/vuemail';
import Email from './email.vue';

const inbound = new Inbound({
    apiKey: process.env.INBOUND_API_KEY
});

const html = await render(Email, { url: 'https://example.com' });

// sending an email via inbound
await inbound.emails.send({
  from: 'Acme <acme@inbound.new>',
  to: 'user@gmail.com',
  subject: 'hello world',
  html,
});

// replying to an email that was received via inbound
await inbound.emails.reply(email.id, {
  from: 'Acme <acme@inbound.new>',
  html,
});
```

## Try it yourself

> **[Get started on Inbound](https://inbound.new)**
>
> See it on our examples.


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