> ## 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 email using MailerSend

> Learn how to send an email using Vuemail and the MailerSend Node.js SDK.

## 1. Install dependencies

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

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

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

```sh pnpm theme={null}
pnpm add mailersend @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

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

```ts theme={null}
import { render } from '@vuemaildev/vuemail';
import { MailerSend, EmailParams, Sender, Recipient } from "mailersend";
import Email from './email.vue';

const mailerSend = new MailerSend({
  apiKey: process.env.MAILERSEND_API_KEY || '',
});

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

const sentFrom = new Sender("you@yourdomain.com", "Your name");
const recipients = [
  new Recipient("your@client.com", "Your Client")
];

const emailParams = new EmailParams()
  .setFrom(sentFrom)
  .setTo(recipients)
  .setSubject("This is a Subject")
  .setHtml(emailHtml)

await mailerSend.email.send(emailParams);
```

## Try it yourself

> **[MailerSend example](https://github.com/psycarlo/vuemail/tree/main/examples/mailersend)**
>
> See the full source code.


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